yashsingh1/xdaforums huggingface dataset:
[G1 Android Development] pistol4413:
I used the file from the thread for 3.6.7. whould u say urs is better. Even with my g1 overclocked and with compcache and it still lags little bit. Seedy for the find question u clearly state that its for 3.6.8.1. Was his wondering if it works with the experimental becuase not haveing compcache is a deal breaker.

Edit: are you sure about the experimental version because he said he is using a new kernal. S
[G1 Android Development] MrBlueEyez:
Tried the script and my Android on CM 3.9.2 works smoothly. Checked with free on Terminal, seems to swap nicelly. What i don't get is the configuration... I downloaded the userinit.sh and user.conf, pushed to /system/sd and did the chmod stuff...

Do i have to change my user.conf to change the configuration? And what configuration works best for 3.9.2?

Nice work though! Finally after 5 months i had the guts to root and update SPL, recovery and mod my phone. Want to get the best out of it!:D
[G1 Android Development] fridlack:
Ok, with the file in this post you have a compcache actived in swap partition without swap in CM ROM, thats correct?

And fixt the clock of CPU in MAX=528 and MIN=245, if i want to manage CPU status with set CPU what lines must to delete?

I only want to activate compcache in my 32mb swap partition, no swap, no CPU overcloack...

Thanks for your help and sorry for my english :)
[G1 Android Development] pychobj2001:
For some reason this is the only one that word on the experimental builds...the others didn't work well even tho it said good compress 74 percent all the time..i would go to "tunewiki" cause that thing is the biggest memory hog, play some music see if it would load fast and then press back to go to the playlist...w/ compcache and swap off it would just go to a black screen and ask to wait or force close...but when the userinit stuff worked it would play stuff fast and go to the playlist without a hitch and no wait time...aka no killing the task in the background because of low memory....hurray..my compcache is working again..it might have had something to do w/ a .conf file...the others didn't have that file....hmmm, anyways thanks huanyu for this and whoever started playing w/ compcache in the first place!!! ha...
[G1 Android Development] uwonsum:
Very very nice, you basically re-wrote the whole thing from your original. Great work and thanks!

edit: The minimum usable cpu frequency is 128000, anything lower will cause the phone to freeze once power plug is removed.

here the available options:

19200

122880

128000

245760

384000

528000
[G1 Android Development] alapapa:
I don't get it...what's the point of a config file for a config file?
[G1 Android Development] meental:
jus to clairify to test it the command should be

instead of
[G1 Android Development] meental:
ah wat the duece, double post
[G1 Android Development] uwonsum:
There is a good reason to have a user config file for an init script.

One simple example; the previous less functional script had options to enable compcache and linux-swap. If you wanted just linux-swap, you would have to go into the init script and edit out the lines you don't want and then add lines you do want--this makes things a little confusing for some users. With user config file, you simply set one to 0 and the other to 1. You could call this encapsulation.
[G1 Android Development] fallinprince:
Soo what are the commands to do these while on the phone

i can get the files into the phone but im not at home so i cant use my ADB
[G1 Android Development] Pinesal:
Tested with CM 3.9.2 and this works wonderfully.
[G1 Android Development] uwonsum:
Check this out. May be huanyu will consider adding these steps...
[G1 Android Development] rondey-:
I had compcache working with 3.9 and upgraded to 3.9.1 then 3.9.2 and it stopped working somewhere in that time frame. I searched and tried two other userinit.sh files from other threads, including one that was supposed to work regardless of the kernel and couldn't get it to work again.

Threw these files on my sdcard, remounted system/sd, copied them over. Changed permissions, ran it manually and it worked fine. Rebooted to test and it worked perfect.

I spent about 2 hours yesterday searching through posts and trying to get this working again. Found this one today and not a single issue, thanks
[G1 Android Development] huanyu:
if you don't wanna to enable CPU overclock or change the virtual memory configuration, you can basically set the follows
[G1 Android Development] sacredsoul:
Can I have your opinions on which is the best option in the performance point of view. I have a swap partition. Should I enable backing swap or the swap partition? Thanks!
[G1 Android Development] pychobj2001:
If you could maintain a version numbered system for your compcache scripts that would rock, so every time you modify it and we try different setups we could know which "version" we like and use that one....I would love this...I never know what i'm getting w/ all these compcache/swap scripts..but this is the best working one by far..and which roms it works w/...like tested w/ 2.4.1 kinda stuff...IDK just some random thoughts....and would love to see a maintained compcache thread!!!
[G1 Android Development] sacredsoul:
Ok I tried but hanged at the G1 screen for 3.9.3. Apparently, the exit command have to be removed from the userinit.sh. I removed the last "exit;" in the file but still got stuck. Any idea guys?
[G1 Android Development] ttabbal:
Perhaps you should post what you are trying to accomplish? I don't see that value and doubt it exists, or needs to.
[G1 Android Development] pinetreehater:
He is talking about the directions in the OP for how to To use compcache with backing_swap. I couldn't find it either.

You are told to "-set linux_swap_eanable=0"

but the is no such configuration in the user.conf file. I just ignored the this....

By the way, since I enabled the backing swap over the linux swapp...I've encountered stutters. Can't have that. Even if it is a placebo effect, I'm going back to the linux swap with compcache. Thanks for everyone's hard work
[G1 Android Development] richpadg:
I read through the first post and still am a little confused. I am using a linux-swap of 32mb right now. Can I use the script as is, and if not, what changes should I make to it?

Thanks
[G1 Android Development] SexualChocolate:
Im a true noob here so dont flame.

I followed the page 1 instructions to a T and I get 2 errors when running the -s command for the verify. Im using Cyanogen 3.9.7

Ive got a 1GB SD card (factory card) with a 32mb swap, 512mb ext2 and the rest is FAT32

!!!ERROR Compcache disabled

Failed to open /dev/block/ramzswap0: No such file or directory

ERROR!!! Set CPU: powersave_bias - 0(system) 200(user)
[G1 Android Development] pinetreehater:
You will have to supply some things before anyone can help...

What does your userinit.sh look like..post it in a code box.

What does your user.conf looke like
[G1 Android Development] SexualChocolate:
I downloaded the userinit.sh and user.conf from page 1.

I will say however that I did have a previous version of it 2 days ago and Im not sure if copying the new version will overwrite the old version. i downloaded the new version today (since I changed from 3.9.5 to 3.9.7) and I followed the instructions from page 1 again.

EDIT: A reboot fixed the issue. There is no mention in post 1 that after applying the script you need to reboot before testing to see if it worked ;)

(like I said Im a noob)
[G1 Android Development] Glyphix:
Yes -- I am wondering about this too.

Also wondering about the setting for cc_memlimit. It says...

To use compcache with backing_swap
-set compcache=1
-set cc_backingswap_en=1
-set linux_swap_eanable=0
-set cc_disksize=0
-set cc_memlimit=8

But in one of the files, the default is set to 24, and the other it is set to 18. -- was wondering (since the "linux_swap_eanable" seems like a typo) if the "8" could also be a typo, and it is actually supposed to be "18"

just curious
[G1 Android Development] Chahk:
When Cyanogen first compiled compcache I tried it out but found it wasn't running well on my G1. The phone would get unusually warm, and slow down after a few hours of operation. So I went back to using a 24MB linux-swap partition with good results.

My questions are:

1) Are the heat issues gone with latest compcache builds/settings?

2) How is the phone's speed with compcache compared to plain linux-swap partition?
[G1 Android Development] cal3thousand:
I've found that the compache swap is running great. I noticed that with the default swappiness of 60, things would get slow eventually as the partition filled. But with 24 swappiness on 32Mb, it has greatly improved the usability and speed of my G1.
[G1 Android Development] ThR1LL:
What program would you recommend?
[G1 Android Development] Chahk:
Notepad++ works just fine.
[G1 Android Development] ttabbal:
memlimit tells compcache how much ram to use. After a day or so, my phone uses about 5MB of RAM storing about 20MB of compressed data. So at 8MB memlimit (assuming it allocates a chunk at startup and just uses that, makes sense to avoid memory fragmentation) my phone is wasting 3MB of RAM. If you set it to 18MB, you would be wasting 13MB. I use 8 as I want a little room to expand as needed. I don't want it higher as it's wasteful and unnecessary. The more RAM you compress, the higher the possibility that you will get poor performance and FCs as well. It's all a balancing act.

My "swappiness" is currently 30, and I'm using a 32MB backing-swap. Seems to be working well overall on cm-3.9.7.
[G1 Android Development] cal3thousand:
Textpad.exe
[G1 Android Development] cal3thousand:
Observations: It took 2 boots for it to work with my system.. not sure why.. could be that i did the change on the first boot right after upgrading to 3.9.7 Oreo v40

anyways... Compache is running just fine by itself with this mod.

BTW, Do i need to CHMOD 755 the user.conf file everytime I edit the parameters?
[G1 Android Development] pinetreehater:
Still a little warm. But this version of compcache with the backing swap seems to be working very well...I think the developers are on to something. This may be the holly grail type of thing because my phone is doing things it couldn't do before (even with imeem running).

Edit: ok, not completely reload free with imeem, but the reloads are quicker and fewer.

***I could not get both compcache and backing-swap running with Uwonsum's post #115 script. However, the latest version at the OP worked if you follow the directions in the code boxes.

My output looks a little different than others. Some peoples output says Compcache kernel enabled. Mine says actually identifies that I am using compcache v0.6

C:\Users\Will>adb shell sh /system/sd/userinit.sh -s
===CompCache status===
CompCache version 0.6+
Compcache enabled
CompCache: MemLimit 8192(system) 8192(user)
CompCache: BackingSwap /dev/block/mmcblk0p3(system) /dev/block/mmcblk0p3(us
CompCache: cc_swappiness - 30(system) 30(user)
=== CompCache status ===
BackingSwap: /dev/block/mmcblk0p3
DiskSize: 32098 kB
MemLimit: 8192 kB
NumReads: 311
NumWrites: 1528
FailedReads: 0
FailedWrites: 0
InvalidIO: 0
PagesDiscard: 0
ZeroPages: 71
GoodCompress: 100 %
NoCompress: 0 %
PagesStored: 960
PagesUsed: 230
OrigDataSize: 3840 kB
ComprDataSize: 897 kB
MemUsedTotal: 920 kB
BDevNumReads: 86
BDevNumWrites: 497

===VM status===
Set VM: page-cluster - 1(system) 1(user)
Set VM: laptop_mode - 0(system) 0(user)
Set VM: dirty_expire_centisecs - 3000(system) 3000(user)
Set VM: dirty_writeback_centisecs - 500(system) 500(user)
Set VM: dirty_background_ratio - 5(system) 5(user)
Set VM: dirty_ratio - 10(system) 10(user)
===CPU status===
Set CPU: scaling_min_freq - 245760(system) 245760(user)
Set CPU: scaling_max_freq - 528000(system) 528000(user)
Set CPU: sampling_rate - 2000000(system) 2000000(user)
Set CPU: powersave_bias - 200(system) 200(user)
[G1 Android Development] dwang:
I'm noticing that compcache 0.6 seems to work much better than 0.5.

I don't notice a significant slowdown after using compcache for a day or so. And the back doesn't get hot like before.
[G1 Android Development] jj972:
===CompCache status===
CompCache version 0.6+
Compcache enabled
CompCache: DiskSize 32768(system) 32768(user)
CompCache: cc_swappiness - 30(system) 30(user)
=== CompCache status ===
DiskSize: 32768 kB
NumReads: 912
NumWrites: 1765
FailedReads: 0
FailedWrites: 0
InvalidIO: 0
PagesDiscard: 0
ZeroPages: 101
GoodCompress: 67 %
NoCompress: 2 %
PagesStored: 1664
PagesUsed: 611
OrigDataSize: 6656 kB
ComprDataSize: 2360 kB
MemUsedTotal: 2444 kB

===VM status===
Set VM: page-cluster - 3(system) 3(user)
Set VM: laptop_mode - 0(system) 0(user)
Set VM: dirty_expire_centisecs - 3000(system) 3000(user)
Set VM: dirty_writeback_centisecs - 500(system) 500(user)
Set VM: dirty_background_ratio - 5(system) 5(user)
Set VM: dirty_ratio - 10(system) 10(user)
===CPU status===
Set CPU: scaling_min_freq - 245760(system) 245760(user)
Set CPU: scaling_max_freq - 528000(system) 528000(user)
Set CPU: sampling_rate - 2000000(system) 2000000(user)
Set CPU: powersave_bias - 200(system) 200(user)

is 67% good compress good??

And also, i used to use the benchmark test on setcpu just to test out my phone and back on 3.9.6 with compcache it would hit the 500s consistently and sometimes the 400s. Now im getting 600s and 700s and a few 500s.
[G1 Android Development] dwang:
that has nothing to do with compcache. 3.9.7 modified the cpu scaling mechanism so that it stays at 384mhz more often (to improve battery life) so thats probably why u are getting higher numbers than before.
[G1 Android Development] jj972:
Ok thanks for pointin that out....and is 67% good?
[G1 Android Development] AsaSpades:
I enabled Compcache @ 32mb and Linux Swap with 32mb and swappiness of 24, when I check it it says

"Linuz SWAP enabled on /dev/block/mmcblk0p3

ERROR!!! Set Linux Swap: swappiness - 30(system) 24(user)"

whats th@ mean?
[G1 Android Development] uwonsum:
See post #156
[G1 Android Development] smeat:
I was investigating cpu scaling for the G1 and ran across some forums for the Pre where they were talking about getting the smoothest response from their processor. One of the users had suggested lowering the up_threshold of the ondemand governor. The default for this setting is 40, which is the percent of cpu usage before going up a speed step. The Pre users had his set at 14, I have been running my G1 at 15 and it is really responsive.

Edit: Forgot to mention they also changed the sampling_rate to 1000000 as well.

Here are patches to the userinit.sh and user.conf files if you would like to try to add this to your script.

--- userinit-1.3.2.sh 2009-08-05 21:56:32.000000000 -0500
+++ userinit.sh 2009-08-05 21:42:37.000000000 -0500
@@ -32,6 +32,7 @@
scaling_max_freq=528000
sampling_rate=2000000
powersave_bias=0
+up_threshold=40

CC_NEW_DECT=0;
@@ -179,6 +180,7 @@
echo scaling_max_freq=$scaling_max_freq
echo sampling_rate=$sampling_rate
echo powersave_bias=$powersave_bias
+ echo up_threshold=$up_threshold
fi;

}
@@ -427,6 +429,7 @@
echo ${scaling_min_freq} > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;
echo ${scaling_max_freq} > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
echo ${powersave_bias} > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/powersave_bias;
+ echo ${up_threshold} > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold;
fi;

}

--- user-1.3.2.conf 2009-08-05 21:56:47.000000000 -0500
+++ user.conf 2009-08-05 21:44:02.000000000 -0500
@@ -47,7 +47,8 @@
# 528000
scaling_min_freq=245760 # default 245760
scaling_max_freq=528000 # default 528000
-sampling_rate=2000000 #default 200000 depending on kernel version
+sampling_rate=2000000 # default 200000, depending on kernel version
powersave_bias=200 # default 0, CM3.9.6 default uses 200
+up_threshold=15 # default 40, percent cpu usage before going up a speed step
}
[G1 Android Development] huanyu:
I have fix this in the #1. should be linux_swap_en=0.

You can still use this script if the third partition of your sd is a linux-swap partition.
[G1 Android Development] dwang:
Thanks this works really well.

[/B]
[G1 Android Development] uwonsum:
I have been reading and playing with other cpu and virtual ram configurations, and over the weekend I will do some more testings.
[G1 Android Development] huanyu:
Thanks for the patch.

Set it down from 40 to 15 you definitely make the phone more responsive, however, did you notice a battery drain?
[G1 Android Development] uwonsum:
You are right, this may be good for performance but not for battery Power efficiency-- Your battery will die quicker. Read the reason below.

Edit: I am thinking a good up_threshold value combined with both sampling_rate and powersave_bias values would definitely achieve good performance and battery power efficiency.

From IBM:

Use the ondemand governor (introduced in Linux® kernel version 2.6.10) to dynamically changes CPU frequency in response to CPU utilization. Use this governor to automatically select the highest available processor frequency when the processor load rises above a definable threshold (up_threshold). Because the governor requires time to respond to changes in system load, performance might be reduced if your workload utilization changes frequently.

If CPU utilization rises above the threshold value set in the up_threshold parameter, the ondemand governor increases the CPU frequency to scaling_max_freq. When CPU utilization falls below this threshold, the governor decreases the frequency in steps; that is, it sets the CPU to run at the next lowest frequency. The lowest frequency that the CPU can go is bounded by scaling_min_freq. After each sampling_rate milliseconds, the current CPU utilization is reexamined and the same algorithm is applied to dynamically adjust the CPU frequency to current process load.
[G1 Android Development] smeat:
I was reading that IBM doc a well. I will be testing it to see how the battery performs. The down stepping is the reason for lowering the sampling_rate. So basically if you are doing something that uses the processor at all it jumps up to 528000, but then as soon as it is idle for a few seconds the cpu starts to throttle down.

The powersave_bias could prevent the jump on reaching the up_threshold from going to the max allowed frequency. I am pretty sure with the current 200 default for powersave_bias unless you really push your phone you will jump to 384000 instead of 528000, and that is the voltage drop point.

Basically I am saying the same thing as you, we need to doing testing with various powersave_bias and up_threshold settings to see how we can stay in a sweet spot for responsiveness and battery longevity.
[G1 Android Development] smuvman:
just checkin

===CompCache status===

CompCache version 0.6+

Compcache enabled

CompCache: DiskSize 32768(system) 32768(user)

CompCache: cc_swappiness - 30(system) 30(user)

=== CompCache status ===

DiskSize: 32768 kB

NumReads: 7914

NumWrites: 10450

FailedReads: 0

FailedWrites: 0

InvalidIO: 0

PagesDiscard: 256

ZeroPages: 391

GoodCompress: 73 %

NoCompress: 5 %

PagesStored: 7777

PagesUsed: 2740

OrigDataSize: 31108 kB

ComprDataSize: 10674 kB

MemUsedTotal: 10960 kB

===VM status===

Set VM: page-cluster - 3(system) 3(user)

Set VM: laptop_mode - 0(system) 0(user)

Set VM: dirty_expire_centisecs - 3000(system) 3000(user)

Set VM: dirty_writeback_centisecs - 500(system) 500(user)

Set VM: dirty_background_ratio - 5(system) 5(user)

Set VM: dirty_ratio - 10(system) 10(user)

===CPU status===

Set CPU: scaling_min_freq - 245760(system) 245760(user)

Set CPU: scaling_max_freq - 528000(system) 528000(user)

Set CPU: sampling_rate - 2000000(system) 2000000(user)

Set CPU: powersave_bias - 200(system) 200(user)

i dont have any issues i just wanted to know if these stats look right or not. i used the conf. and .sh from the first page oh yea im on 3.9.7
[G1 Android Development] uwonsum:
This was a great idea. I will use some formula to calculate the best threshold value. For those who still do not fully grasp the idea, keep in mind that once it hits the threshold, it will always jump to the highest frequency set by the scaling_max_freq and this is where using the powersave_bias and sampling_rate plays a major role. I believe there are three unique values when combining up_threshold, powersave_bias, and sampling_rate that would suit most users regardless of how this device is used.

Edit: up_threshold= 32, 24, 16 are good numbers to test compared to default 40.
[G1 Android Development] smeat:
Huanyu, I meant to put the default value for up_threshold in the user.conf that is included in the download package. Might not be a bad idea to do that on the next release.

Sorry about that.
[G1 Android Development] huanyu:
That's ok, i have done this since v0.1.3.4.
[G1 Android Development] pinetreehater:
The OP posted somewhere (to me, no less because I had the same question) about this issue.

Your problem occurs when you don't set the swappiness the same on compcache and either backing or linux swap. Set them both the same for now.

This is supposed to be fixed soon. Search for my posts in this thread and you will see the original poster's reply about this error.

Will
[G1 Android Development] sha.goyjo:
Good numbers in combination with what other factors? Could you explain a little more?
[G1 Android Development] uwonsum:
I am not against having this option to tweak around. I will continue to play with it. There is no doubt that lowering the up_threshold increases performance, but at what cost? I think Cyanogen was smart to use 40 because the default is actually 80. Let me explain.

This is not conclusive. Setting the up_threshold too low cannot be good for battery life. As you can see in the data below, am just playing music and running the top command. My minimum CPU frequency is 128MHz. Assuming, I set the up_threshold to 16, what will happen is, the CPU will jump to 528MHz because I have passed the 16% mark. This is not what you want. This case would even be worse if the powersave_bias is not there to bring it back down to 384MHz and fluctuate between the 2 highest CPU speeds. As of now, I do think setting the sampling rate to 1000000 is a good idea. Again, this test method is not conclusive and may even be flawed. It is something to think about as you play with these settings.

User 20%, System 6%, IOW 0%, IRQ 0%
User 66 + Nice 0 + Sys 20 + Idle 236 + IOW 0 + IRQ 0 + SIRQ 0 = 322

PID CPU% S #THR VSS RSS UID Name
1381 19% S 11 31244K 2428K media /system/bin/mediaserver
1774 4% R 1 908K 296K root top
1695 0% S 7 104916K 13832K app_48 org.mmin.handycalc
1402 0% S 48 176596K 20964K system system_server
1444 0% S 17 107704K 14340K radio com.android.phone
1596 0% S 7 93828K 11444K app_47 com.modroid.battery
7 0% S 1 0K 0K root khelper
8 0% S 1 0K 0K root suspend

Edit:3 values I am currently testing

sampling rate = 1000000

up threshold = 32

power save bias = 200