yashsingh1/xdaforums huggingface dataset:
[G Tablet Android Development] jimcpl:
Hi,

That could be, but as I mentioned in my post above, at least that cpuinfo_cur_freq "file" has perms of ONLY "r--------", i.e., it's only readable by user root. So, even with my rooted Gtab, my app couldn't read it. That kind of threw me for awhile, had to get my app to do "su" then chmod the file to something that would allow non-root to read.

I just got that working yesterday.

My app uses as .ini file in /sdcard, but right now only allows a single parameter. I'm going to modify it so that you can put as many file/paths in it as you want, and then the app will monitor all of those, and display the results in a notification (the notification part works already). Even with just the one file, it's pretty neat watching the cpuinfo_cur_freq bounce around (on stock 3053).

I was really trying to get this working while you all were working the kernel lag problem, but that root/su thing threw me off. Sorry about that :(...

Jim
[G Tablet Android Development] anlog:
When you change the parameters of CPU0 they are almost always copied to CPU1. And yes, CPU1 is turned off when not in use or if the screen is off, etc. Setting the parameters for CPU0 should be enough, so apps like Overlock Widget should work fine.
[G Tablet Android Development] jimcpl:
CpufreqMonitor

Hi,

I'm attaching the APK for my app, CpufreqMonitor.

You'll need to be rooted for this, and create a file, /sdcard/cpufreqmonitor.ini.

The file has the following lines:

<SU command line>

<full path/filename>

.

.

For example:

/system/bin/su

/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq

/sys/devices/system/cpu/cpu1/cpufreq/cpuinfo_cur_freq

or, if just "su" is available, just have:

su

on the 1st line, with the paths/filenames on the subsequent lines.

When you run it, click the Start button to start monitoring. It will display the results in the notification area, updating every 30 secs.

Note that you'll only be able to see as many values as can fit in the notification area.

Jim
[G Tablet Android Development] gunsjoe:
I switched to zeam, was using launcher pro. After switching I started experiencing the lag after sleep issue. I switched back to launcher pro. I have not seen it with launcher pro.
[G Tablet Android Development] MarkF001:
:o

OK, so which fixes the problem on TnT 3389?

I assume vsc should work? But, we all know about assumtions.

THANKX
[G Tablet Android Development] k3for:
bug in Jim's CPUfreqMonitor?

Jim, just send you a pm - getting an error on CPU1 in the taskbar - java.io.FileNotFoundException: /sy... (can't read rest of it in the taskbar).

I can read CPU1 cur_freq fine in Root Explorer.

Running stock TNT 3389 from VS, rooted but no Gapps or PerfPack.

Tripled checked the .ini - can't see what's wrong.

Thanks,

K3FOR
[G Tablet Android Development] jmdearras:
Just lay or crash?

I have more a problem with crash on wake. Maybe 25% of the time I get "the birds" instead of my last opened app. Is this related to the lag issue, or is it a separate issue?

Thanks,

Jim
[G Tablet Android Development] jimcpl:
I just PM'ed you...

Jim
[G Tablet Android Development] vsc:
I think that is yet another issue which I'm not sure how to debug as no log seems to be preserved. Also I haven't been able to make it happen when I have been watching it with USB connected.
[G Tablet Android Development] MarkF001:
repeat

OK, so which fixes the problem on TnT 3389?

I assume vsc should work? But, we all know about assumtions.

THANKX
[G Tablet Android Development] lamlam01:
can this be incorporated into a .sh script, chmod to executable and dropped onto the /sdcard and run from there?
[G Tablet Android Development] Neoprimal:
No easy way to just code in there that the minimum frequency is 245mhz?
[G Tablet Android Development] anlog:
I don't see why not???
[G Tablet Android Development] anlog:
Not sure I understand why???

When the min frequency is set to less than 1ghz the clock will drop and won't go back.
[G Tablet Android Development] thebadfrog:
anlog,

I am running 3389 update with Rothnics performance pack. Before running the script I was getting the sleep lag 75% of the time from a wake up. Since running scripts I have set my wifi to "never" shut off and have put it to sleep a few times and let itself go to sleep a few times. I haven't had the lag come back yet and I run quandrant after every wake up and score 2300+. Granted it hasn't been that long and I will continue to keep testing but I thought an update would be nice
[G Tablet Android Development] anlog:
So far so good! Keep us posted!
[G Tablet Android Development] Neoprimal:
That's odd. I was under the impression that it only happened when the tablet drops to 216mhz and below, as a matter of fact - it was your post that mentioned it. I just picked 245mhz because you also mentioned "On a clean boot my cpuinfo_cur_freq file fluctuates between 246406 and 286484, but there is no slowness." and in checking it out myself, it looks like in many other android devices the minimum frequency at least in the 528-1Ghz processor range, seems to be 245 for some reason, heck even my old G1 seems to run at a minimum of 245mhz. Called a couple buddies with different devices and their minimums are also at 245mhz.

Maybe their engineers have done some testing and know something that we're just figuring out? There's gotta be a reason they set the minimum at that number right? As opposed to say 200 or 215....can't just be coincidence? (I could be wrong!) My point is that I'm thinking 245/246Mhz may be the sweet spot for it not to get stuck....whether an Android code issue or something else, 245 is what other Android sporting devices are at.

The tablet operates at the minimum needed at most times, no? It's generally running at lower frequencies until it is under pressure.

From what I've read of that max scaling instruction in the code, it just sets the CPU limits, but doesn't specifically say low power mode = a number, performance = a number because that was supposedly incorporated with some framework or another (I don't know exactly what I'm talking about, of course - just putting together tidbits of what I've been reading elsewhere). Am I right about that?

So setting it to 1Ghz would unduly drain the battery, I think - since that would be saying, "lowest limit for the CPU is 1Ghz", even when it's idled/asleep/hibernating. That would be like running a benchmark app 24/7 - even while sleeping.

Please correct me on all fronts that I'm wrong, you're my mentor(s) and I'm interesting in learning to at least know in depth.
[G Tablet Android Development] rcgabriel:
anlog - I agree, this workaround *seemed* to work for me (just steps 4c-4h - after I did this last night I was unable to force the lag-on-wake again). Still want to find the real fix though too. :)
[G Tablet Android Development] thebadfrog:
Sorry, Just picked up tab and the lag is back. Checking the cpuinfo gives me "216000".
[G Tablet Android Development] rob_z11:
Would it make sense to keep minimum to 528000, so CPU has room to rev up if it needs to go higher if requires.
[G Tablet Android Development] anlog:
Overclock Widget by itself does this, but it doesn't fix the issue.
[G Tablet Android Development] anlog:
Same here. It just clocked me down finally after almost 24 hours.

Back to the drawing board...
[G Tablet Android Development] Neoprimal:
From what I understand, if the limit is 1Ghz on the high end then that's room enough. The problem seems to occur when the CPU gets down to 216Mhz as reported now by several people - which is why I was wondering if there's a way to just set it to 245/246Mhz permanently as the minimum limit, so as not to go below that. With my logic, if it doesn't go below 246Mhz, then we shouldn't see the problem....of course, maybe I read it incorrectly and got it all wrong! lol

If setting it with those parameters still doesn't fix it then obviously there's something else hidden in there. If you are setting it to a minimum of 1Ghz and it still clocks down then obviously there's something else going on. Maybe we can contact Notion Ink or something - they seem friendly and the Adam looks like a pretty nice Tablet....it's also obvious they put A LOT of work into their code and OS so maybe they can tell us something about the cpu frequency settings for the Tegra 2?
[G Tablet Android Development] rcgabriel:
Can you PM me or post a patch file? Thanks!
[G Tablet Android Development] rcgabriel:
anlog - it really did seem to affect the frequency of this issue for me too. Sorry to hear it didn't solve the problem outright though. I just got a third dmesg snapshot with lag-on-wake though - this one was really interesting because it had been asleep for hours and I see lots of the G Tablet cycling through suspend and resume in dmesg. And sure enough, again I see errors, though this time it's error -16 not -11, and it's from platform_pm_suspend this time. Not sure what to make of that.
[G Tablet Android Development] anlog:
I see now what you were suggesting. If setting it at a minimum of 1ghz doesn't work, then other settings probably wont either. Leaving it at 1ghz all the time shouldnt drain the battery any faster if there isn't a load on the processor.

I'm pretty certain that something else is superceding the governor settings, because my scaling_governor is still set to performance. The default is blank.
[G Tablet Android Development] anlog:
My CPU dropped as soon as I hit 85%.
[G Tablet Android Development] Neoprimal:
See, this is where you lose me....I don't understand.

If the governor is set to a MINIMUM of 1GHZ, why is the CPU running at less than 1GHZ even if there's no load? This is what has me confused.

My understanding was that the scaling instruction sets the maximum and minimum limits of the acceptable CPU rates.

So if the max is set to 1Ghz then the CPU cannot be running at 1.1Ghz, for example. Right?

Likewise, if the governor is set to 250Mhz minimum, then it won't go below 250MHz

But what you're essentially saying is that at 1GHz minimum set in the scaling, it's still ramping up and down depending on the load....or am I missing something?

Essentially then, what are you accomplishing by trying to set it at 1Ghz anyway if it's still ramping up and down while set to the max rate in both maximum and minimum?

It is very difficult for me to explain what I'm trying to so please bear with me. If I repeat myself it's because I want to be as clear as possible.

So, alright...

Max = 1Ghz

Min = 1Ghz

but you say the battery won't drain since the cpu isn't under load.

What I'm thinking (obviously incorrectly) is that if

Max = 1Ghz, then CPU cannot be clocked at more than 1Ghz and is only able to scale from the Minimum value, to the Maximum value, which is 1Ghz.

Min = 1Ghz, then the CPU cannot be clocked at less than 1Ghz and is only able to scale from the Minimum value, to the Maxmimum value, whichy is 1Ghz.

In my mind, what this says is that the code you've used is supposed to basically lock the CPU at 1Ghz so that it runs at that level all the time. Which would essentially translate to using the battery since load or no load, it's running at 1Ghz.

I hope you get what I'm trying to say, lol. I don't know how else to put it.

Now, if the code is being 'ignored' somehow and the governor is being forced by something (maybe power management is hard wired into the drivers), then perhaps setting a more realistic value would work.

Could you guys maybe try something more modest? Like a minimum scaling of 300Mhz and leave the max at 1Ghz? I still believe in setting it to 245 or 246....

I'm thinking if there are some kind of 'acceptable' values for power management and such set in framework, then getting it to work may be a matter of specifying a more logical number.

So, if the driver or hard code says "CUSTOM PWM = low value 200-500, high value 501-1000 ELSE PWM default low value 215, high value 1000"...then what you've done by 'defying' the lowest low value is to make it automatically kick into some hardware default.

Hopefully you get the drift of the nonsense I've written.

haha, I remembered ELSE from the class in college where I decided I'd never want to do programming. So...don't laugh at me TOO hard.
[G Tablet Android Development] gotwillk:
yea that part doesn't make any sense to me either. why would battery not drain any faster if its constantly at 1ghz? its like saying a tv that is turned on is not draining electricity if there is no picture being displayed on screen.
[G Tablet Android Development] bloodlust22:
I did find a work around that works currently from me besides tuning the unit off everytime I'm not using it. When my tab is asleep I hit the power button 3 times. Effectively waking, putting back to sleep and waking again. This seems to solve the slow CPU issue upon wake for me. Not sure ifanyone else has tried it.
[G Tablet Android Development] Butch1326:
I set my gtab to 300000 (min), 1000000 (max). I felt that if going below 246000 was the slowdown threshold, no benefit in setting the min to 1000000.

The gtab is faster as it was overclocked. No slowdown issues to report after 5 hours of use since I made the setting change. Watched the Dallas / Arizona game on the gtab. Did not see a major battery drain. At 40% left after 14 hours of use today.

Although, I haven't been seeing the slowdown issues that many others have been reporting.
[G Tablet Android Development] Neoprimal:
This is exactly what I wanted tested. So, is setting it using the terminal permanent? Or does it 'reset' when there's a reset/update?
[G Tablet Android Development] rob_z11:
True that part of the test, but I am not sure if he put his tablet to sleep for prolong time to test his 300000 minimum clock.
[G Tablet Android Development] gotwillk:
but i thought the slowdown occurs after you've let it sleep for a couple hours. if you've had it on and been using it the whole time, the slowdown shouldn't occur.
[G Tablet Android Development] rob_z11:
Exactly. If I keep using mine all day, there is no slow down.
[G Tablet Android Development] Neoprimal:
Well I certainly hope he didn't sit using his G Tablet for 14 hours on Christmas day! :D

I shot an email to Notion Ink. Not really holding my breath on a response but it would be cool and they seem community friendly. I'd been interested in one for a long time but it just never released and now finally after I ordered the Archos 101 it went on preorder and sold out :/ in a day. Then I ordered my G Tab.

Anyway, I've been checking out reviews and youtube videos and they seem to be really dedicated to the device and it's software (a startup has to be, right?). They're like a less tyrannical, micro scale Apple, who does everything with their devices in house, in terms 'creating' the OS. They have their own engineers that work on the tablet's OS called Eden (Adam, Eden...clever!, next one is Eve I bet) which is of course built on Android, and seem to put a lot of work into it so I'm hoping one of em' can swing on over and help us out. Maybe they've seen the issue and dealt with it. As improbable as it may be that they pay any attention to me, my Grandma used to always say, "nothing beats a failure but a try".
[G Tablet Android Development] rcgabriel:
Just to confirm - I captured a dmesg output from a "good" wakeup/resume and in fact there is no evidence of error -16 (EBUSY) or error -11 (ETRYAGAIN) from platform_pm_suspend or platform_pm_suspend_noirq respectively in there. So at the very least, those errors are closely associated with the stuck CPU at min frequency. I'm still not clear if they are indicative of a cause (i.e. an error in a driver causes something not to get reset properly on resume) or effect (the slowdown in CPU speed or other internal clock speed causes devices to respond improperly on resume).

I am thinking that some of the suspend/resume cycling may be related to wifi connecting and disconnecting activity, and that's why I see so many suspend/resume cycles in my dmesg file, and that would explain why people report they aren't seeing the lag-on-wake issue if they go to airplane mode or disable wifi manually before going to sleep.

There are quite a few patches in the mainline Harmony code that seem like they could be related to this, that are more recent than the branch our stock kernel uses.

I also am very curious to hear back from clemsyn about what changes he made to the kernel and whether he still thinks he's solved the problem.
[G Tablet Android Development] Butch1326:


Well I certainly hope he didn't sit using his G Tablet for 14 hours on Christmas day!

----------------------------------------------------------------------------------------

Actually, I did use the gtab for approx. 14 hours yesterday. I had one of those quiet Christmas moments this year :D

During the day yesterday, I let the gtab sleep for different periods of time from a couple of minutes to an hour + just to get a feel for the behavior at different battery charge levels. Some have reported slowdowns starting at 80-85% charge.

I successfully drained the battery when I woke up this morning, so now it is in recharging mode. We'll see what happens again later today.

Unfortunately (or fortunately, depending on your point of view), I have not been able to repeat the slowdown issue. Although, the change to 300000 (minimum) has made my gtab zippier :)
[G Tablet Android Development] thebadfrog:
Just woke my GTab up and the lag is there. Tried shutting off the wifi before putting it to sleep last night. For me this solution doesn't work. This almost has to be an issue where the GTab is not issuing the right command to speed the processor up or there are some serious issues with this chipset. Checking cpuinfo always returns 216000 when its lagging.
[G Tablet Android Development] rob_z11:
I had wakeup bug when tablet went to sleep for about 5 hours. Wokeup this morning with bad bug of morning sickness.
[G Tablet Android Development] anlog:
Your analogy isn't the same. Now if you were referring to an amoled screen displaying all black, you would be closer.

Clocking the CPU higher will use a tiny bit more battery if there is no load on it (sitting idle). If you are using the tab or running a number of CPU intensive background processes then yes, it absolutely will consume more power and battery.

Simply clocking it to 1ghz all the time is not going to slaughter your tab. I'm going on 36 hours now constantly clocked at 1ghz with normal usage. I'm still at 43% battery.
[G Tablet Android Development] gotwillk:
turned it on this morning and no lag. it was asleep for a little over 6 hours. both cpu still at 1000000. first run of quadrant score: 2442

i had it plugged in and charging and i'm running vegan b3b. had contacts, picasa, and calendar synced turned off. only have gmail sync on. no wifi keep alive widget turned on.
[G Tablet Android Development] jimcpl:
Maybe things behave differently when sleeping with vs. without power plugged in?

Jim
[G Tablet Android Development] anlog:
Is this with the script?
[G Tablet Android Development] thebadfrog:
Thats an interesting thought. For the most part mine has been plugged in to AC power.
[G Tablet Android Development] gotwillk:
yup followed the script exactly.
[G Tablet Android Development] vsc:
FYI,

In CMOS power consumption is,

P = V^^2 * f * C

Where,

V = voltage

f = switching frequency

C = load capacitance

Thus power consumption is linear with frequency. C is a constant for a given design. And normally we would reduce voltage at lower clock rates. Clock gating is also used at a macro scale or within modules in the design.

You are suggesting that most of the device has the clock gated off, thus clock rate is not a factor. Perhaps but there is no way to know the micro-architecture of the Tegra2, at least without a NDA...
[G Tablet Android Development] anlog:
So then the script seems to at least delay the slowdown longer than normal?

It seems like with the newer kernel roms the slowdown often happens after a single sleep. I wonder if the script should run every few hours on the tab like a cron job.
[G Tablet Android Development] rob_z11:
Anything interesting that one can put finger on what is causing the slowdown yet?

There were times that it had wakeup bug with wireless shut or airoplane mode.

I am going to try with the lower cycle to 300000 to see if it helps.
[G Tablet Android Development] clemsyn:
Not sure if I did since I have no way of testing it (left my G-pad at home while vacationing) I posted it before but decided to pull it out since you mentioned that lag might still be there. If you want to try it out, PM me and I'll upload it so you can test it out. Basically what I did was enable all the modules for the Power Mangement and disabled CPU idle PM support.

If you have any more ideas (like disabling CPU Frequency to leave speed at max, I think) LMK and I can build the kernel for you to test.

Update:

I'll just upload it here..Let me know how it goes. Make sure clockwork is installed, unzip then insert in your ROM.
[G Tablet Android Development] clemsyn:
BTW, if you will use the boot.img that I posted. Please note that to install programs that installs in asec (eg. Angry Birds, Frozen Bubble), you need to unmount the SD first to install it in Data partition. After installation you can mount it again and use the installed programs.
[G Tablet Android Development] anlog:
I was suspecting that maybe the tegra performance drivers were causing the issue, but even the stock firmware (including the latest 3389) has the slowdown.

I just tweeted a message to Viewsonic about this. Not sure if they will act on it...

This is a major issue, and I'm hoping one of the devs will release a fixed kernel with the latest fixes from NVIDIA...
[G Tablet Android Development] thebadfrog:
I'm tempted to try this but, did you actually install it on yours or just compile a new kernel. I'm sure I can recover if it borks my tab but I don't want to do the work :D
[G Tablet Android Development] clemsyn:
I actually installed it on my Viewsonic and worked. Had issues with market but I'm pretty sure I didn't do the market fix properly. I used it with Vegan beta4.
[G Tablet Android Development] rob_z11:
Can someone post the process of how to insert the boot into current installation of the vegan beta4.
[G Tablet Android Development] thebadfrog:
Thanks...having a fight with my droid right now but I've downloaded it and I'll give it a shot in a bit.

Will I be able to use SetCPU and adjust the settings?
[G Tablet Android Development] thebadfrog:
under /sys/devices/system/cpu I have a folder named cpu0 and cpu1

cpu0 folder has

/cpufreq

/cpuidle

/topology

online

cpu1 folder has

/cpuidle

online

I used to have the same folder structure in both cpu0 and cpu1. Am I only running 1 cpu now? I can only get the info from cpu0
[G Tablet Android Development] anlog:
Check the "online" file in CPU1. It should be "1" (active). If not, then set it to "1". If you don't get the same structure then maybe the kernel was compled without SMP???
[G Tablet Android Development] thebadfrog:
Cpu1 is set to 0....gonna reboot and then check and set

EDIT: Same after reboot but bad news for me the wife wants her GTab back and I'm not allowed to mess with it anymore. I regret the day I introduced her to Angry Birds
[G Tablet Android Development] clemsyn:
You should not have any /cpuidle on any cpu since it was disabled in the kernel. It should only be cpufreq and topology folder n both cpus. Did you do a fresh reinstall after installing hte kernel.
[G Tablet Android Development] anlog:
That's why I have TWO gtabs.