For caffeine, I'm probably consuming way too much. I use french roast (less caffeine + less acid) with an espresso machine (course grind folgers rather than fine grind). I think it comes out to roughly slightly less than 1.5 cups (12 fluid ounces) per dose.
I take a dose within about 1 - 1.5 hours of waking up and another dose half way through the day. I need to start taking the second dose earlier so 1) I don't experience the mid day crash and 2) there's less in my system when I go to bed.
For melatonin I take 3mg about an hour or two before going to bed and another 3mg right before going to bed. Sleep is generally good, but not as much as I would like, which I think is partly due to going to bed too late, thus light entering my room due to insufficient window blackout methods.
Something weird I notice about melatonin is that it helps me get work done just before bed, because my mind thinks less about it and just does it, but this probably isn't the best way to work.