[Droid Incredible Android Development] smw420:
In light of Hand76's comments, I would like to amend my previous post.

When I first read Hand76's post, my first thought was "yea, but with this kernel that doesn't seem to be so". However, I took his advice and was shocked that I got the same performance increase with 245/460i as if I had set Screen Off at 460/460i.

Two things. One, battery drain in that one hour I had the phone asleep was unnoticeable. Phone reported the exact same millivolts before and after, so running at 460 didnt drain as much as I thought it might. Now I realize that it was only 1 hour, so that finding is at most anecdotal. Two, if this setting of 245/460i produces the exact same performance coming out of sleep as 460/460i does, then it would seem to me that the jumping from one profile to another might be where the issue is. Maybe it IS SetCPU after all (just not really SetCPU's fault).

If the 245/460i setting works as a Screen Off profile, then when you hit the button and the screen comes on, within 50ms the kernel (not SetCPU) does jump to 460 before you have a chance to unlock the screen. If a 245/245 Screen Off profile is used, maybe it takes SetCPU longer to realize the screen has been turned on resulting in the CPU running for much longer at 245, and not jumping out of the profile fast enough. Even if the lag was 1 second, that would be longer than it would really take to hit the button and swipe the unlocker. Does anyone know how often SetCPU polls for screen-on info?

Hand76's idea DOES solve the problem since the kernel is the deciding factor when it switches to the max cpu speed even in the Screen Off profile. 50ms is unnoticable to humans in reality so his idea IS the solution. Running 245/245i or Powersave fails only because of SetCPU's lag to detect the change in screen status. And it would seem so by design - if SetCPU polled the crap out of the status of the screen, wouldn't that just kill the battery even faster? I think "fixing" SetCPU to poll faster would just take it out on your battery.

I want to test the default speed difference between 245/998 vs 384/998 since i was able to notice several instances where lag vanished after the screen was unlocked, but that's a whole different topic. But for now, it looks like there might be a viable explanation for the laggy behavior we've been experiencing when unlocking. I'll stop here and let those who know a whole lot more about this continue the debate.

-M

P.S. - After typing all that I turned my phone on and got the same lag as before. Now I am rethinking this (again). What I want to know is how long it takes SetCPU to know the screen is OFF. When I tested it before, I was kicking the screen on and off rather quickly giving it only a few seconds of off-time before retesting. However, when it sits for "many minutes" it acts differently when coming out of sleep. I wish I could get a log file with a timestamp for each time SetCPU changes profiles ;). My thought now is what HAPPENS when SetCPU changes profiles. Are we swiping the unlocker at the same time SetCPU is trying to exit out of Screen Off profile? If so, if SetCPU is banging hard during that operation, that could explain the lag.