Time spent choosing to do nothing (e.g. doing mindfulness meditation while lying eyes-closed on a hammock), with your brain fully engaged in doing nothing, would be "productive."
Time when your brain forces you to do nothing (sleeping, or even just "comfortably" dozing off); or when you do something poorly, because of brain fog or an inability to learn quickly; or when your executive functioning or memory screws up and you choose to do something that doesn't minimize regret among all the things you could equally-well have chosen to do—would all be "unproductive" time.
(Equally well, you would be "unproductive" when your body isn't doing what your brain tells it to do—though in most cases the answer there is to either choose your concrete goals to match your physical capabilities, or to work to increase those capabilities. Stephen Hawking's time was not unproductive. People with Chronic Fatigue Syndrome, though, mostly are unproductive, because their physiology gets in the way no matter what they choose to do.)
A fun—and, to me, oddly enlightening—analogy: on a CPU, productivity is a lot easier to measure. Electricity costs money; calculations can make you money. Thus, executing useful instructions is productive; while executing NOPs is unproductive. And the less electricity you use to execute the same code, the better. Sleep-states aren't as productive as executing useful code, but they're more productive than executing NOPs, insofar as NOPs cost you money that sleep-states don't. More useful instructions per second requires more cooling, and cooling requires electricity, so parallelism isn't necessarily more productive, just "faster" in some sense we don't necessarily care about. Etc. (Is there a name for this measure? Lifetime net operating profit of a given capital asset, as attenuated by different ways of employing it?)
Optimizing for lifetime area-under-the-curve "productivity" in this sense would be very interesting to me.
Any magic optimizing formula would certainly have to account for that subjective value. (Although, being tired can sometimes function as a desirable altered state of consciousness; it can be very satisfying to work on a creative project late into the night.)
Now at 30, if I get less than 8 hours of uninterrupted sleep a few days in a row, I'm a zombie and I feel the negative effect in all my activities: brain fog at work, depressed, no lust for social gatherings, sports or sex.