yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] gu5t3r:
root@android:/mnt/sdcard # sh Download/ksm2.sh

================================================
Data DeDuping UKSM savings - 18.20 MB!
================================================
3.65 = Benefit/Cost Ratio -> HIGHER IS BETTER!
19.99 Benefit Ratio x Shared 0.91 MB = 18.20 MB
5.48 Cost Ratio x 18.20 MB = 99.64 MB (Unique)
47 - Full Scans SINCE BOOT.
0 min 8 secs (8 seconds) Needed Per Scan
UKSM Executes 80.00 Times Per Full Scan
================================================
UKSM Per Minute Summary (Based on Awake Time)
UKSM Executes 600 Times.
136.46 MB - Scanned Beneficially Per Minute.
747.30 MB - Scanned Wastefully Per Minute.
================================================

Current UKSM Values:
===================

full_scans - 47
hash_strength - 66
min_scan_ratio - 1
pages_scanned - 165728
pages_shared - 233
pages_sharing - 4658
pages_unshared - 25508
run - 1
scan_batch_pages - 5000
sleep_millisecs - 100
sleep_times - 3603
thrash_threshold - 50

================================================
System Awake Time is 0:06:48
================================================
System Idle Time is 0:02:18
================================================
System Deep Sleep Time is 0:00:05
================================================
System Up Time is 0:06:53
================================================

root@android:/mnt/sdcard # sh Download/ksm2.sh

================================================
Data DeDuping UKSM savings - 10.54 MB!
================================================
2.05 = Benefit/Cost Ratio -> HIGHER IS BETTER!
11.84 Benefit Ratio x Shared 0.89 MB = 10.54 MB
5.77 Cost Ratio x 10.54 MB = 60.84 MB (Unique)
66 - Full Scans SINCE BOOT.
0 min 20 secs (20 seconds) Needed Per Scan
UKSM Executes 200.00 Times Per Full Scan
================================================
UKSM Per Minute Summary (Based on Awake Time)
UKSM Executes 600 Times.
31.63 MB - Scanned Beneficially Per Minute.
182.52 MB - Scanned Wastefully Per Minute.
================================================

Current UKSM Values:
===================

full_scans - 66
hash_strength - 576
min_scan_ratio - 1
pages_scanned - 287274
pages_shared - 228
pages_sharing - 2699
pages_unshared - 15577
run - 1
scan_batch_pages - 5000
sleep_millisecs - 100
sleep_times - 12780
thrash_threshold - 50

================================================
System Awake Time is 0:22:17
================================================
System Idle Time is 0:11:26
================================================
System Deep Sleep Time is 0:00:05
================================================
System Up Time is 0:22:22
================================================

BUT

AND

cat /proc/uptime
1201.38 628.54

I never use PC for charging... Always charger... I don't think uksm keeps phone awake, I think it runs while screen is off a little time before deep sleep because users reported increased battery drain overnight... So to make sure, I made a script (which is optional) to turn uksm off while screen off...

To test, I would need to leave one night phone with uksm_service and one night without and compare scans...
[Android Software/Hacking General [Developers Only]] zeppelinrox:
Gags on grep... Which was my first suspicion.

OK do:

/system/bin/grep
[Android Software/Hacking General [Developers Only]] hisname:
u0_a95@jgedlte:/ $ su

root@jgedlte:/ # /system/bin/grep

sh: /system/bin/grep: not found

127|root@jgedlte:/ #

I am using stericison busybox
[Android Software/Hacking General [Developers Only]] zeppelinrox:
Yeah best to test that.

But it's an easy test.

Run the script.

Turn the screen off

turn it on after 5 minutes or so.

run the script.

See if deep sleep goes up and full scans stays the same.

Not too sure about that screen shot. Are those all the frequencies?

Do:

cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state

The uptime corresponds with the ksm script output.

ok seems that grep -m 1 is not working nice with newer setups.

Do this EXACTLY... copy/paste.

su
mount -o remount,rw /system
sed -i 's/grep -m 1/grep/' /system/xbin/flush
sed -i 's/grep -m 1/grep/' /system/etc/init.d/96superflush

See if flush works
[Android Software/Hacking General [Developers Only]] ndwgs:
This made me lulz-cative.

Lol
[Android Software/Hacking General [Developers Only]] gu5t3r:
Seems that your method of Deep Sleep calculation does not work for my kernel...

CPU Spy says 36min of DS but your script says 5sec...

Of course that are not all freqs, other freqs are hidden in "under 1%"

cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state
134400 321608
184320 1868
249600 3859
364800 3110
460800 852
576000 25746
652800 15
768000 47
806400 7
921600 28
1017600 24
1113600 9
1209600 8
1305600 10
1401600 455
1516800 47400
1612800 8

---------- Post added at 04:56 PM ---------- Previous post was at 04:30 PM ----------

Also, pages_scanned keeps increasing while screen is off, so as I suspected uksm works when screen is off until DS...

My uksm_service script prevents that...

pages_scanned does not increase on DS...
[Android Software/Hacking General [Developers Only]] hisname:
:(

u0_a95@jgedlte:/ $ su
root@jgedlte:/ # mount -o remount,rw /system
root@jgedlte:/ # sed -i 's/grep -m 1/grep/' /system/xbin/flush
root@jgedlte:/ # sed -i 's/grep -m 1/grep/' /system/etc/init.d/96superflush
root@jgedlte:/ #
[Android Software/Hacking General [Developers Only]] DBDMagic:
Every since I did that 3g installer thing my wi fi will not work how do I fix it I did what it said and it still doesn't work

Cm 10.1.2 (Olive Oil) Samsung Hercules, Hercules!
[Android Software/Hacking General [Developers Only]] zeppelinrox:
lol @ lulz-cative :D

Ah but you forget one thing... CPU Spy says that uptime is over an hour, while the /proc/uptime file and my script report about 20 minutes.

Which one is accurate? 20 minutes or an hour?

Looks like CPU Spy added sleep time to the time reported in /proc/uptime

If my script is correct, then it's not going to DS when the screen is off.

Disable your uksm script to take that out of the equation - just in case it's effecting DS somehow.

No error so it worked.

Now do flush normally... geez :p

The commands you did edited the FOM scripts.

Hopefully, the edited code will make it not gag.

Read the 3GTC comments in build.prop
[Android Software/Hacking General [Developers Only]] DBDMagic:
Don't wanna sound dumb but I read it still don't know didn't see where it told me how to fix it u meant build.prop in my system folder right?

Cm 10.1.2 (Olive Oil) Samsung Hercules, Hercules!
[Android Software/Hacking General [Developers Only]] zeppelinrox:
I see you're one of those that like flashing the "tweak of the day".

So... UnTurboCharge first and see if it works then.

If not, it's probably one of the other tweaks that you've installed that fubarrs it.
[Android Software/Hacking General [Developers Only]] hisname:
:thumbup:

works at last
[Android Software/Hacking General [Developers Only]] gu5t3r:
My script was off during tests... Screenshot was taken later, your script always shows DS 5 secs...

================================================
Data DeDuping UKSM savings - 14.74 MB!
================================================
3.44 = Benefit/Cost Ratio -> HIGHER IS BETTER!
14.98 Benefit Ratio x Shared 0.98 MB = 14.74 MB
4.36 Cost Ratio x 14.74 MB = 64.21 MB (Unique)
62 - Full Scans SINCE BOOT.
0 min 32 secs (32 seconds) Needed Per Scan
UKSM Executes 640.00 Times Per Full Scan
================================================
UKSM Per Minute Summary (Based on Awake Time)
UKSM Executes 1200 Times.
27.64 MB - Scanned Beneficially Per Minute.
120.40 MB - Scanned Wastefully Per Minute.
================================================

Current UKSM Values:
===================

full_scans - 62
hash_strength - 51
min_scan_ratio - 1
pages_scanned - 383475
pages_shared - 269
pages_sharing - 5934
pages_unshared - 21467
run - 1
scan_batch_pages - 4545
sleep_millisecs - 50
sleep_times - 11664
thrash_threshold - 50

================================================
System Awake Time is 0:33:14
================================================
System Idle Time is 0:22:22
================================================
System Deep Sleep Time is 0:00:05
================================================
System Up Time is 0:33:19
================================================
[Android Software/Hacking General [Developers Only]] zeppelinrox:
So... how long was it up for in those shots?

~30 minutes or ~1:30 minutes?

You can also check uptime with busybox uptime

fyi if I run the ksm script, turn off the screen for a few seconds, turn the screen back on and run the script again, deep sleep time goes up accordingly - when the screen goes off, my device almost immediately goes to sleep.
[Android Software/Hacking General [Developers Only]] gu5t3r:
Busybox uptime shows same time as your script, but it is not correct....

In my latest post, difference between taking Cpu Spy screenshot and script output is less than minute...

---------- Post added at 07:18 PM ---------- Previous post was at 07:17 PM ----------

Could build.prop tweaks cause that?

---------- Post added at 07:21 PM ---------- Previous post was at 07:18 PM ----------

persist.adb.notify=0
ro.ril.disable.power.collapse=0
pm.sleep_mode=1
ro.mot.eri.losalert.delay=1000
wifi.supplicant_scan_interval=180
ro.config.nocheckin=1
ro.kernel.android.checkjni=0
ro.kernel.checkjni=0
profiler.force_disable_err_rpt=1
profiler.force_disable_ulog=1
logcat.live=disable
debug.sf.hw=1
persist.sys.ui.hw=1
debug.performance.tuning=1

---------- Post added at 07:23 PM ---------- Previous post was at 07:21 PM ----------

My battery lasts very long and that would not be the case if phone is not entering DS...
[Android Software/Hacking General [Developers Only]] zeppelinrox:
CPU spy reports on my device the same as the script.

The script subtracts wake time (total CPU times) from uptime to get sleep time.

Seems that /proc/uptime is not correct?

Edit: my guess is that when it enters deep sleep, /process/uptime stops being updated
[Android Software/Hacking General [Developers Only]] gu5t3r:
Yes, seems that way...

But phone works best ever on LuPuSv16, and even OC to 1.5GHz (UV) and using uksm, I get a long battery life even I'm using second hand battery from eBay...

I got 2 batteries + external charger for $16... Original battery at the time was about $35...
[Android Software/Hacking General [Developers Only]] zeppelinrox:
OK dude test this...

echo $((`date +%s`-`awk '/btime/{print $2}' /proc/stat`));awk -F. '{print $1}' /proc/uptime

Output should be the same like this...

38861

38861

If the values are different, it proves your uptime file is fubarred.

And if I can't rely on the uptime file, I can rely on teh maths lol
[Android Software/Hacking General [Developers Only]] gu5t3r:
3755
3755

---------- Post added at 09:03 PM ---------- Previous post was at 09:01 PM ----------

Cpu Spy says 4h4m

Uptime says: 1h4m
[Android Software/Hacking General [Developers Only]] zeppelinrox:
geezus...

ok do you use FOM?

If so do:

stat /data/B*ush*; date

That will for sure report a time that's close to boot time.

OH I just had a thought... it MIGHT be due to a time zone descrepancy?
[Android Software/Hacking General [Developers Only]] gu5t3r:
XD

root@android:/mnt/sdcard # stat /data/B*ush*; date
File: '/data/BootLog_FastEngineFlush.log'
Size: 2455 Blocks: 5 IO Block: 4096 regular file
Device: 1f03h/7939dInode: 7780 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2013-03-24 01:57:19.000000000
Modify: 2013-08-04 17:06:38.000000000
Change: 2013-08-04 17:06:38.000000000
Sun Aug 4 21:14:30 CEST 2013

Was using it up to 2 days ago, disabled it to see if there will be any difference, but I didn't remove it from init.d so it probably just runs and exits...
[Android Software/Hacking General [Developers Only]] zeppelinrox:
Oh okay.

But I forgot that it should run once no matter what lol

What's the time stamp at the top of B*ush* ? lol

16:59?

If so it looks like CPU Spy is accurate indeed.

edit: ok from previous testing, I think a sure fire way to get boot time is using time stamps of the files in /dev.

Do:

stat /dev/alarm

Pretty sure all roms have that alarm file
[Android Software/Hacking General [Developers Only]] gu5t3r:
root@android:/mnt/sdcard # stat /dev/alarm
File: '/dev/alarm'
Size: 0 Blocks: 0 IO Block: 4096 character special file
Device: dh/13dInode: 1923 Links: 1 Device type: a,1d
Access: (0664/crw-rw-r--) Uid: ( 1000/ system) Gid: ( 1001/ radio)
Access: 2013-08-04 16:58:00.000000000
Modify: 2013-08-04 16:58:00.000000000
Change: 2013-08-04 16:58:00.000000000
[Android Software/Hacking General [Developers Only]] zeppelinrox:
Bingo...

Try this...
[Android Software/Hacking General [Developers Only]] gu5t3r:
=)

It displays correct DS time =)

Will do test tomorrow and report back...
[Android Software/Hacking General [Developers Only]] zeppelinrox:
Nice.

But I'm afraid that you may have a big bug.

Phone should goto sleep "for real" with the screen off.

Because it doesn't, that may be why uksm keeps doing full scans.

Or it does go to sleep and things like uksm don't know it.

The fubarred uptime file is probably a direct symptom of it.
[Android Software/Hacking General [Developers Only]] arenaboy007:
I'm great at following instructions, but with so much info posted in the OP's post, I don't know where to start. I have an Xperia GO running on CM10.1. Can anyone guide my through the installation process? The amount of info is overwhelming me, lol.
[Android Software/Hacking General [Developers Only]] Jar3112:
Believe me, it's simple.

Run latest v6 script, follow the instructions, read the output and you'll be done.

Sent from my Galaxy Nexus
[Android Software/Hacking General [Developers Only]] gu5t3r:
Yes, pages_scanned increased a lot overnight and full_scans increased about 40...
[Android Software/Hacking General [Developers Only]] Computoncio:
Here's other paste

app_164@
app_164@android:/sdcard/Download # sh ksm2.sh

================================================
Data DeDuping UKSM savings - 68.43 MB!
================================================
5.70 = Benefit/Cost Ratio -> HIGHER IS BETTER!
14.24 Benefit Ratio x Shared 4.80 MB = 68.43 MB
2.50 Cost Ratio x 68.43 MB = 171.07 MB (Unique)
8 - Full Scans SINCE BOOT.
38 min 54 secs (2334 seconds) Needed Per Scan
UKSM Executes 4668.00 Times Per Full Scan
================================================
UKSM Per Minute Summary (Based on Awake Time)
UKSM Executes 120 Times.
1.76 MB - Scanned Beneficially Per Minute.
4.40 MB - Scanned Wastefully Per Minute.
================================================

Current UKSM Values:
===================

abundant_threshold - 10
cpu_governor - [full] medium low quiet
cpu_ratios - 20 40 MAX/4 MAX/1
ema_per_page_time - 92162
eval_intervals - 1000 500 200 50
full_scans - 8
hash_strength - 64
max_cpu_percentage - 95
pages_scanned - 1027830
pages_shared - 1230
pages_sharing - 17519
pages_unshared - 43794
run - 1
sleep_millisecs - 500
sleep_times - 18175
thrash_threshold - 50

================================================
System Awake Time is 5:11:12
================================================
System Idle Time is 4:15:19
================================================
System Deep Sleep Time is 4:19:32
================================================
System Up Time is 9:30:44
================================================

app_164@android:/sdcard/Download #

Phone: Samsung Galaxy SII - GT-I9100

Kernel: Dorimanx kernel v9.35

1st ROM : Vanilla RootBox Nightly 20130730 (Online)

2nd ROM : Resurrection Remix v4.0.4

MODEM: Modem+RIL - XXLS8

MODS: My RR mods, My RB mods, Partition Fix, ASUL v5.1.1 by Kroz :good: and V6 SuperCharger:p
[Android Software/Hacking General [Developers Only]] hisname:
i patched my services.jar and received a bootloop :( android 4.3

I just uploaded the original services.jar, I will upload the modified one later
[Android Software/Hacking General [Developers Only]] zeppelinrox:
hmm okay I just noticed [MENTION=4603254]Daniel D.[/MENTION] has the same issue.

No deep sleeps in his output on lupus kernel too I believe.

I don't think anybody else has posted output with the same uksm version as you.

you hadn't patched it before?

That log shows nothing.

Copy paste from the ultimatic window.
[Android Software/Hacking General [Developers Only]] arenaboy007:
Is this the particular instruction I need to follow?

1. Download a script

2. Install BusyBox (Attached! - see install instructions above the attachments)

3. Install Script Manager (Enable Browse as Root in Config)

4. Load script into Script Manager (Run As Root - the skull and crossbones icon which turns green when selected)

5. Follow instructions/user prompts & select what you want

6. Patch services.jar as needed (see Post 2)
[Android Software/Hacking General [Developers Only]] zeppelinrox:
hey I read somewhere the uksm may not play nice with some cpu governors.

Try changing governors and (interactive, smartass, whatever) and see if deep sleep gets counted with the ksm2 script.

Or see if busybox uptime shows the correct value uptime value.
[Android Software/Hacking General [Developers Only]] gu5t3r:
OK, will try... Thnx
[Android Software/Hacking General [Developers Only]] El_Dark:
Guys,

Just in case someone has the same issue as me with the zipalign:

http://xdaforums.com/showpost.php?p=19136839&postcount=2

This one worked fine for me ;)
[Android Software/Hacking General [Developers Only]] zeppelinrox:
hmm... almost same size as the starter kit one.

Maybe I'll use that one instead as it seems to work fine on JB

Edit: BTW did it segfault if you simply typed zipalign?

Or did it give you help options?
[Android Software/Hacking General [Developers Only]] arenaboy007:
I'm stuck at step 6. I can't connect my phone in charging mode only. So I only end up at daemon started successfully, when I ran Ultimate Jar Patcher tools bat.

Xperia GO CM10.1
[Android Software/Hacking General [Developers Only]] zeppelinrox:
If you're running the latest bat, make sure the phone's screen is on.

You may see it asking permission... something about a device key blah blah.

Basically, it's the same idea as when you're waiting for something to get root permissions.

Worst case, patch it offline.
[Android Software/Hacking General [Developers Only]] mixednuts:
Same advice, twice in one day. Showing some patience there zep... good for you. :D
[Android Software/Hacking General [Developers Only]] t-ryder:
As I said before... lag almost totally adiós thanks to v6 SC.

One more question...

My defaults i build.prop are

1)

dalvik.vm.heapstartsize=8m
dalvik.vm.heapgrowthlimit=64m
dalvik.vm.heapsize=256m

After the recommended tweak during run in sManager with the script I got an additional

2)

dalvik.vm.heapstartsize=8m
dalvik.vm.heapgrowthlimit=132m
dalvik.vm.heapsize=132m

for my SGS3 MIUI ROM. First it was additional, but I deleted 1) and set 2) as default.

Could somebody explain the values? I thought higher values matching for the device is better?

(Yes... learning. Me = rookie)
[Android Software/Hacking General [Developers Only]] hisname:
alright,gimme a few mins,need to make a nandroid

alright, I have uploaded the log and modified services.jar. original services.jar is a page back
[Android Software/Hacking General [Developers Only]] hoholee12:
It means normal programs and largeheap enabled programs will get the same 132mb heapsize.
[Android Software/Hacking General [Developers Only]] zeppelinrox:
When heapsize is filled, garbage collection kicks in.

Too small a heapsize can cause lag when GC happens.

Too big a heapsize can cause lag too and use up resources for nothing.

I think 64 is too small these days and 256 is over kill and it's probably more complicated than need be.

So I made them both the same percentage of a devices ram.

btw do notice a difference?

It's weird how users that one would expect to know better, somehow don't.

Running baksmali to decompile and get smalis...

Error while disassembling method Lcom/android/server/enterp
rise/email/ExchangeAccountPolicy$ExchangeAccountBroadcastRe
ceiver;->onReceive(Landroid/content/Context;Landroid/conten
t/Intent;)V. Continuing.
org.jf.dexlib.Code.Analysis.ValidationException: class Land
roid/app/enterprise/IExchangeAccountPolicy$Stub; cannot be
resolved.
at org.jf.dexlib.Code.Analysis.ClassPath$Unresolved
ClassDef.unresolvedValidationException(ClassPath.java:536)
at org.jf.dexlib.Code.Analysis.ClassPath$Unresolved
ClassDef.getSuperclass(ClassPath.java:540)
at org.jf.dexlib.Code.Analysis.DeodexUtil.parseAndR
esolveMethod(DeodexUtil.java:212)
at org.jf.dexlib.Code.Analysis.DeodexUtil.lookupVir
tualMethod(DeodexUtil.java:103)
at org.jf.dexlib.Code.Analysis.MethodAnalyzer.analy
zeInvokeVirtualQuick(MethodAnalyzer.java:3640)
at org.jf.dexlib.Code.Analysis.MethodAnalyzer.analy
zeInstruction(MethodAnalyzer.java:1106)
at org.jf.dexlib.Code.Analysis.MethodAnalyzer.analy
ze(MethodAnalyzer.java:213)
at org.jf.baksmali.Adaptors.MethodDefinition.addAna
lyzedInstructionMethodItems(MethodDefinition.java:389)
at org.jf.baksmali.Adaptors.MethodDefinition.getMet
hodItems(MethodDefinition.java:311)
at org.jf.baksmali.Adaptors.MethodDefinition.writeT
o(MethodDefinition.java:132)
at org.jf.baksmali.Adaptors.ClassDefinition.writeMe
thods(ClassDefinition.java:338)
at org.jf.baksmali.Adaptors.ClassDefinition.writeVi
rtualMethods(ClassDefinition.java:310)
at org.jf.baksmali.Adaptors.ClassDefinition.writeTo
(ClassDefinition.java:117)
at org.jf.baksmali.baksmali.disassembleDexFile(baks
mali.java:186)
at org.jf.baksmali.main.main(main.java:308)
opcode: invoke-virtual-quick
CodeAddress: 8
Method: Lcom/android/server/enterprise/email/ExchangeAccoun
tPolicy$ExchangeAccountBroadcastReceiver;->onReceive(Landro
id/content/Context;Landroid/content/Intent;)V

Note that "Error blah blah" = bad news.

I'll have to find out if the current baksmali is compatible with decompiling 4.3 odex roms.

Try a deodex version if there is one.

Oh, and the new services.odex is about 1.5 mb smaller - that's another clue.
[Android Software/Hacking General [Developers Only]] hoholee12:
i thought about doing this:

heapgrowthlimit=ramsize

heapsize=ramsize/6

it means: i rely on the information that non largeheap enabled apps will be small so i dont have to collect garbages or anything.

Do you think its a good idea?
[Android Software/Hacking General [Developers Only]] gu5t3r:
Wouldn't it be more logical that normal apps can use 1/6th or ram i.e. heapgrowthlimit=ramsize/6 and largeheap enabled apps can use half ram i.e. heapsize=ramsize/2 ?

As heapgrowthlimit should alwas be under 1/2 of heapsize ???
[Android Software/Hacking General [Developers Only]] hoholee12:
heapsize=ramsize/2 will be enough for gaming.

well im testing right now with 9999999m on heapgrowthlimit, and i havent got any problems.
[Android Software/Hacking General [Developers Only]] hisname:
blah blah blah. boring . anyway, I have no time to deodex my rom. will be busy till end of next week. ask someone else to test for you
[Android Software/Hacking General [Developers Only]] gu5t3r:
Heapgrowthlimit is heap limit for normal apps, if app has good code it should never need more than ram/6 (think android default is ~ ram/7)

So, you just removed heap limit for normal apps... You can make it 9E100, but whats the point if you have 512 ram?

9999999m is same as 512m on 512 ram device

Again, heapgrowthlimit should never be bigger than heapsize (1/2 of it better)...

What I'm testing is that I lowered heapstartsize from 5m to 4m on my LT18i and I think I have more free ram on boot...but maybe it's placebo...

But my logic is that maybe some apps didn't need 5m and are good with 4m and that is where I got few mb of free ram...
[Android Software/Hacking General [Developers Only]] zeppelinrox:
Ya maybe someone that knows that I can't do anything with an uploaded services.odex file.

I been too tired and I just realized that you were attaching odex files lol

You musta been too busy to read the basics as well.