We all have our good days and our bad days. Due to insufficient sleep, illness, stress, distractions, and many other causes we often find ourselves far below our usual levels of mental performance. When we find ourselves in such a state, it's not really worth putting effort in doing many tasks, like programming or long term planning - as quality will suffer a lot.
The problem is - other than observing deterioration of results, I have no idea if I'm in such a state or not. I cannot be sure if it's also true for others, but I had to find out a few tests of what's my mental performance at the moment. Tests that are deeply flawed, so I'd request better if there are any. I also cannot predict my mental state in advance, as my life isn't terribly regular.
The most reliable test I found, and by accident, was fighting bots on a certain Quake 3 map - me vs 10 or so highest difficulty bots. The challenge was to get 50 frags without dying. As the map was huge and full of power ups, it wasn't really that difficult as long as I could maintain full alertness for 10-15 minutes - but if I was tired or distracted, I would invariably fail. This test was unfortunately extremely slow.
Another test would be to go to goproblems, and do a few random problems at proper difficulty level. If I could think right, I would do most of them, if I was tired, I would fail almost 100%. This didn't test alertness, I guess it would be best described as short term memory test, as that's what used for game tree exploration. Unfortunately what's the proper difficulty varies a lot with how much go I played recently, so it needs to be recalibrated.
One more test would be to go to some decent online IQ test like this one. My results on such test would suffer a lot if I was sleepy or tired. The main problem is that such tests cannot repeated too often, or I'd just remember the answers.
So these are three ways to test how well my mind functions at the moment, all testing something different, and all flawed in one way or another.
How do you test yourself?
This reminds me of a story I was told about somebody who got so drunk that he forgot he was drunk and drove a car...
Though testing your mental capabilities is useful, there are some problems of trying to access your own mental state. First, if you believe your mental state varies throughout the day, then shouldn't your ability to access it also vary?
I'd say the tests provided by others are decent, but in many cases impractical or of limited use. Say you have to make an important boolean decision. You don't know how sharp your brain is, but you do know that the longer you delay the decision, the worse the outcome will be on average. Depending on how quickly the value of the decision is decaying, it might not make sense to spend hours trying to access your mental state. I don't know exactly how to solve a problem like this.
But I think that simplifying mental performance to a simple linear value doesn't do justice to the complexity of the brain. I find that while my brain has good times and bad times, it's generally more complicated than that. There are times when I can program or understand math well and there are times when my brain is better suited to writing or reading.
So you should try to access your mental performance in the domain of the tasks that you are trying to achieve. If you want to know how well you can do in trigonometry, try to remember the law of cosines. If you're trying to study constitutional law, try to recall all the amendments to the constitution. By focusing mental performance into a specific type of mental performance, you get much more accurate assessments.