yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] defiant07:
Thanks...well that experiment was a miserable fail and waste of a couple of hours :crying:.

/prop/meminfo is no good...you can only get accessible ram, NOT total :(...from my research the only time the info for total ram is accessible is during the boot process, hence my searching dmesg...dunno what to do now :confused:...back to googling I guess...lol

Nice, glad you tailored it to your needs. Yeah, low minfree=better multitasking.
[Android Software/Hacking General [Developers Only]] coolprateek.kumar:
Oo... Then that's an end for me cause our phone hasn't released proper kernel source... So we can't touch the kernel.

Every rom is based on stock kernel.

And the Prateek who made this Night Shade rom is none other than myself.
[Android Software/Hacking General [Developers Only]] ghost141:
Does anyone know, will my sphone (galaxy W) will brick if i swap it at INTERNET sd card?

Since i am not using a single space on it .. Thanks:)
[Android Software/Hacking General [Developers Only]] defiant07:
Sorry man...have you looked at Android Image Kitchen? The kind of changes that would be needed are far beyond me, but it seems you have the knowledge.

lol, never read your whole name, its too damn long and the kumar stands out...I was wondering why you were the OP, when it seemed someone else made it, lol.

By "internet" I assume you mean interNAL...no, but it does degrade lifespan (negligibly from what I've read).
[Android Software/Hacking General [Developers Only]] famewolf:
[MENTION=5146220]defiant07[/MENTION]

My earlier comments about providing a 3rd option were more along the lines of asking the user if they want to create the swapfile on (e)xternal sd, (d)ata, or (u)ser specified.....if user specified they could enter a path they new was symlinked to the app partition such as /data/data or in my case /sd-ext. Some basic checking such as existance of the mount point would probably be necessary but it would mean folks wouldn't have to hardcode the script.

Just a thought.
[Android Software/Hacking General [Developers Only]] ghost141:
defiant07@ sorry for typo.. lol..

so, it will kill the Internal sd card soooner or later too?
[Android Software/Hacking General [Developers Only]] ghost141:
I have create the swap file but i am not sure how to make sure it works,, anyway to do?
[Android Software/Hacking General [Developers Only]] eushaun99:
In terminal, type free. Under swap, you should be able to check it.
[Android Software/Hacking General [Developers Only]] ercea:
Hi, before all, thanks for mod! :). Is recommended to use it in a device with 1gb RAM? I mean, is noticeable? or this mod is recommended with less RAM ?

Regards and thx again :)
[Android Software/Hacking General [Developers Only]] ghost141:
Ercea@ u can use it if u want...

I don't think 1gb RAM is still need SWAP :P

Can i know what's your s.phone model?
[Android Software/Hacking General [Developers Only]] ercea:
Of course, Jiayu G3S, I have been infected with MTK phones :p:

http://www.jiayu.es/es/jiayu/12-jiayu-g3.html

Thanks, then, I'll wait if some day could need this, but, anyway, is very useful and a good idea :)

Regards!
[Android Software/Hacking General [Developers Only]] defiant07:
Quite a good thought :good:...I could add that option, but I think it might lead to a bunch of swapon/swapoff errors being reported because the jb users might start using one of the fake sdcard location...guess I could stick in a warning and ignore the retard posts that ignore my warning.

Yeah, but more like later...no external sd?...I've been running 100 swappiness for like 4 months and have yet to find a corrupt block.

Dunno...try and find out...but yeah logically lower ram devices would notice more appreciable gains.

TY.

But I am pretty sure even with 1gb ram you'll get some gains...read through the reviews for this silly app and there users w/ 1gb ram reporting gains...but who knows could be placebo...furthermore I imagine devs enable swap in the kernel of 1 gb devices for a reason...but who knows maybe they stick it in there just to look cool :cool:.
[Android Software/Hacking General [Developers Only]] ercea:
Yeah, you're right :P, my kernel supports swap so let's try :D. Thanks again ;)

regards!
[Android Software/Hacking General [Developers Only]] famewolf:
When compiling a kernel it's pretty easy to just compile everything as a module...folks can choose whether to load that module or not and if you don't use it, it doesn't waste any space....I imagine that's what they are doing with it.
[Android Software/Hacking General [Developers Only]] zeppelinrox:
Maybe this can come in handy...

awk '/ \/sd/&&/ ext/' /proc/mounts

or

awk '/ ext/' /proc/mounts

It's important to have the preceding space in the search patterns
[Android Software/Hacking General [Developers Only]] defiant07:
Hope ya like it.

Dunno much about the subject, but I bet it is even easier to leave it out...have come across two kernels so far that have not fully/properly implemented it. Moreover, I bet if it offered no performance gains and/or did more harm than good, most devs would leave it out and it seems like it is many custom roms/kernels.

I was about to release a new version yesterday that would allow users to input a custom path, but then all hell broke loose when I updated SuperSU :crying:...not sure how I could use/integrate either of those commands given the custom path option would allow users to choose locations like /cache.

I just gave up trying to fix my supersu issues and I am in the process of restoring a backup...that learn me not to do a nandroid for 2 months :(...once I get my device back up-to-date I'll give it one more test run and then upload...if your bored or want some other code to put you to sleep besides V6, take a look a it and lmk if you can think of some means to check if any user inputted location will work or if you got any other suggestions as they are always most appreciated.

===EDIT===

My bad...seems the problem app was SystemCleanup...should have know Chainfire wouldn't mess up an update so bad :p...one more time from the top...sigh
[Android Software/Hacking General [Developers Only]] famewolf:
OT--

You should try OBackup (in apps forum and in google play) for online nandroid...no reboot required..does CWM and TWRP compatible (and 4EXT reads BOTh of those)...and I've already used them for restores with no issues....makes it easier to schedule a backup....also "Nandroid Manager" can restore from a nandroid...with the option of Apps + Data being especially useful.

OT--

As far as validating the mounts...you can just get the list of mounts and grep on what the user gave you to see if it exists....can use an "if true" or "if false" to check result and act accordingly.

I recently installed the pureperformance scripts on my oldest device...they also include a ram/swap script and I modded it to use the same mountpoint but it set some minfree's and other things so thought you might want to review it:

#!/system/bin/sh
# Thunderbolt by Pikachu
# V6 SuperCharger, OOM Grouping & Priority Fixes created by zeppelinrox.
# Galaxy Ace Optimized by ImbaWind
# Adrenaline Engine

# Enable Linux Swap
swapon /data/swapfile

# Set Swappiness
echo "40" > /proc/sys/vm/swappiness

# ADJ Values
echo "0,1,3,5,7,15" > /sys/module/lowmemorykiller/parameters/adj;

# Minfree Values (80mb)
echo "1280,2560,5120,7680,12800,20480" > /sys/module/lowmemorykiller/parameters/minfree;

It added several scripts to /etc/init.d:

-rwxrwxrwx root root 3231 2008-08-01 08:00 S70darky_zipalign

-rwxrwxrwx root root 10746 2008-08-01 08:00 S98system_tweak

-rwxrwxrwx root root 478 2008-08-01 08:00 ext4_lagfix

-rwxrwxrwx root shell 388 2008-08-01 08:00 net_buffer

-rwxr-xr-x root root 461 2013-07-26 03:51 ram_optimize

-rwxrwxrwx root shell 478 2008-08-01 08:00 remount_fullext4

-rwxrwxrwx root root 2291 2008-08-01 08:00 sqlite_optimize
[Android Software/Hacking General [Developers Only]] defiant07:
The script that is at the core of OBackup and that other similar app are not compatible will my device, it does not properly detect my partitions...talked to the script's dev and he said a patch was not possible :crying:.

Regarding "validating the mounts," I don't think that would avoid swapon/swapoff errors if a user inputs one of those 'fake scdard' locations. Moreover, I think it would make it impossible for the user to make a custom directory for the required files (e.g. if the user wanted to they could make a SwapItOn directory where ever they wanted and then use a custom path like /sdcard/SwapItOn) and since I don't think that directory would register as an unique mount point a precautionary check of that nature would fail.

At any rate, I had already put in a precautionary check to ensure the custom path directory exists, which still will not avoid swapon/swapoff errors, but it would allow for situations like the one described in the above example. You can look at the code...I'll upload it within the next half hour or so.

Haha :p...PureNonsense :eek:...read the pureperformance and puregraphics threads...they are just a haphazard mixture of other mods and they are potentially dangerous...plus the dev doesn't really respond to user problems and I think the reason he doesn't respond is that he doesn't fully understand the mods he 'barrows' stuff from, therefore he don't really even really understand his own mod packages...last I checked (I have been avoiding reading those threads, they get me so annoyed...a moderator actually deleted one of my posts from the pureperforamce thread) the uninstall zip doesn't even do a complete job, lol.
[Android Software/Hacking General [Developers Only]] defiant07:
####### Uploaded v8...Major Update #######​
[Android Software/Hacking General [Developers Only]] famewolf:
INteresting about pureperformance....I reviewed the scripts and the build.prop changes...they looked quite valid...lagfix....etc...alot seems to be ripped from the adrenaline engine but couldn't find a good source install for that. Glad I didn't need any help as the scripts did a good job of speeding up my old hd2....I didn't put it on my new devices.

Thanks for V8!
[Android Software/Hacking General [Developers Only]] defiant07:
I should refrain from talking bad about others works, but I am easily instigated. PureP ain't as bad as PureG as far as valid content in the scripts and build.prop stuff, although I think some of it is still device specific...also a quick skim through the build.prop stuff and there is at least one duplicate entry, lol. Besides adrenaline, there's a lot of stuff from thunderbolt and crossbreeder...those adj and minfree in the script you posted are from V6.

And that swapon command you edited, which used to be:

swapon /dev/block/platform/msm_sdcc.1/mmcblk0p3

is totally device specific...quick google search revealed at least one device that has their radio/modem on that partition.

Having said all that, I think most of the problems some users experience are due to the bin, lib, and idc files, which most users will not or cannot check/validate. From the idc file:

# Input Device Calibration File [B][COLOR="Red"]for the Crespo touch screen.[/COLOR][/B]
#
# These calibration values are derived from empirical measurements
# and [COLOR="Red"][B]may not be appropriate for use with other touch screens.[/B][/COLOR]

LOL...consider yourself lucky I guess and make a backup before flashing your other devices.
[Android Software/Hacking General [Developers Only]] eushaun99:
You outdid yourself again defiant...how did you do the colours lol. Pretty pretty colours...

No problems here...just wanna say thanks for your hard work and dedication to this script.
[Android Software/Hacking General [Developers Only]] defiant07:
Thank you sir for your kind comments and past services...the green is created by echo -e "\e[01;32mYOURTEXT" and it gets applied to all the subsequent lines until commanded otherwise it...I found a bunch of color/text effects codes for linux (some of which don't translate to android...took a bit of testing).

nice :good:...never thought it would evolve so much...it was originally around 80 lines and now it's almost 800 :eek: (about 90 of which are due to your suggestion :p)
[Android Software/Hacking General [Developers Only]] eushaun99:
Looks like you've learnt a lot from this script. I'm just doing the best I can to help improve it. Who knows, give it 2 years and it will be as big as v6. :p
[Android Software/Hacking General [Developers Only]] hoholee12:
case $desiredswappiness in
0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99|100);;

holy moly.

Why not just use other simple solution instead?

First, you can just check whether its a numerical value or not by doing:

[ $(desiredswappiness | tr -d [0-9]) ] || blah blah blah

And for final, check if its under 100 and over 1 like so:

[ $(desiredswappiness) -ge 1 -a $(desiredswappiness) -le 100 ] && blah blah blah
[Android Software/Hacking General [Developers Only]] defiant07:
lol :p...I knew it was pretty retarded, but all the stuff I found for using a range of numbers in a case statement did not translate from linux/ubuntu to android...most of it looked like [0-99]|100). Is there a way to do this on android? Furthermore, I have zero formal programming knowledge/training and only started really playing with this stuff a few months ago...so I am gunna have to plead ignorance << hope that's a valid defense, lol...just learned/read about the tr command thanks to your post ;).

I would integrate your code, but it lacks one thing: it does not check for non-integers (i.e. it would allow for values like 50.5 and I am not sure what the consequences of such a value would be, although I suspect it would not be bad). Is there a means to check for integers? Also it should be -ge 0, not 1 so as to allow for 0 swappiness.
[Android Software/Hacking General [Developers Only]] NYLimited:
You mean less than 101 and greater than 0, right? :D

Yes, I know you used "le" and "ge" in the code section. I was only paying with the English line above that.. ;)
[Android Software/Hacking General [Developers Only]] defiant07:
The 100 is correct being that it is less than or equal to ;), but the 1 should be 0 as I noted in my previous post (again note he used -ge not -gt).
[Android Software/Hacking General [Developers Only]] zeppelinrox:
kids...

Watch 'n learn...

if [ "`echo $desiredswappiness | awk '/[^0-9]/ || $1<0 || $1>100'`" ]; then
echo " Learn how to read and/or type! Bye :p."
exit 69
fi

Or...

if [ ! "`echo $desiredswappiness | awk '!/[^0-9]/ && $1<=100'`" ]; then
echo " Learn how to read and/or type! Bye :p."
exit 69
fi

Or use a third version in the condition that follows the input...

if [ "`echo $desiredswappiness | awk '!/[^0-9]/ && $1<=100'`" ]; then
echo "$desiredswappiness" > $storage/swappinessvalue.txt
if [ -f "$storage/swapfile" ]; then
echo " Do you want to (m)ake a new one that is the"
#etc...
else
echo " Please wait while I create the swap file,"
#etc...
fi
else echo " Learn how to read and/or type! Bye :p."; exit 69
fi

my 2 cents... Just for the awk of it... ;)
[Android Software/Hacking General [Developers Only]] defiant07:
Nice, very impressive...I luv when you awk around with my script, lol...always learn something and it improves the script :highfive:.

Just so I can fully understand its magic, this !/[^0-9]/ is what filters out inputs that contain anything other numeric characters, right? (i.e. this is what allows it to catch decimals and negative values because those contain '.' and '-', which are non-numeric, right?)

thanks again teach :D
[Android Software/Hacking General [Developers Only]] zeppelinrox:
yeah it's a regex pattern.

[0-9] will match anything with a number ie. 3 or -3 will match

[^0-9] will match only strings without a number (because of the ^) so 3 isn't a match, but -3 is a match.

You want the opposite of that (ie. strings with numbers only)... so you put the ! in front.

So it's kinda like saying "if this is not (!) true"

If you wanted to include negative integers you would make it !/[^-0-9]/

To also allow decimals, !/[^-\.0-9]/ (you need to escape the . because normally, a dot is a wildcard (matches any single character) so the \ in front makes the regex look for a dot instead)

You get the idea :cool:
[Android Software/Hacking General [Developers Only]] defiant07:
Released v9…major update…

So I have been kinda testing the settings in the optional tweaks for the past week or so. My not so scientific method was to apply the settings, run with them for a 48 hour period, and put them to ‘which seemed better’ test (I also periodically looked at the output from free, although this a fairly spurious measure). The settings I tested were those from ThunderBolt, a middle-ground/hybrid by me, and those from KickAssKernelizer.

Let me preface this by saying

the differences were marginal

, but my general findings were:

ThunderBolt - fewest freezes (0-1 per day), but most lag/redraw and least responsive

Middle - most swap usage, some freezes (1-2 per day), similar lag/redraw as Thunderbolt, but seemed more responsive and that lag would clear faster << could be placebo and/or bias

KAK - most responsive, least lag/redraw, but least swap usage and most freezes (3-5 per day)

Obviously, results may differ depending on device/rom/kernel/tweaks/etc. So have fun experimenting and seeing what works best for you…to this end there is now a choice of optional tweaks and I added switch swap scripts: tweakstb, tweaksmid, and tweakskak…cheers…enjoy.
[Android Software/Hacking General [Developers Only]] eushaun99:
BUG REPORT!!! :D

There's something wrong with your checking for busybox. It said I'm missing awk even though I have it. Using busybox 1.19.4 wraithdu from zep.

Edit: installed busybox 1.21.0 zeppe-linaro also have the same error.

Edit 2: same goes for stericson's busybox 1.21.1.
[Android Software/Hacking General [Developers Only]] hoholee12:
is your problem.

why not just do this instead?
[Android Software/Hacking General [Developers Only]] eushaun99:
Yup, I changed them and now it works. Thanks.
[Android Software/Hacking General [Developers Only]] hoholee12:
[MENTION=5146220]defiant07[/MENTION] if you want, you can look at my code

https://github.com/lenarox/avcore/blob/master/avcore.sh

this might be helpful to you:)
[Android Software/Hacking General [Developers Only]] defiant07:
GD...sorry man. As you know I am on the starter kit busybox too...I wonder why your device does not like that syntax.

The reason is that using plain grep (e.g. busybox | grep awk) does not return exact matches. So, for example, if you grep cat your results would include the lines with lzcat and xzcat too, thus the test is flawed as the user could have lzcat, but not actually have cat and pass the test.

My syntax returns only the line containing cat as it tests for exact matches.

Again, sorry man...would you mind trying:

busybox | grep "\<cat\>"

and

busybox | busybox grep '\<cat\>'

without the added stuff around the search term the test is imprecise (see above response to LENAROX). Hopefully one of them returns only the line containing cat. Thanks in advance.

Thanks dude, it looks interesting and promising, although I don't understand much of it. I will play around with it/study it in the near future. :highfive:
[Android Software/Hacking General [Developers Only]] eushaun99:
Hey, don't be sorry. I'm always here to help you. Besides, who doesn't make mistakes and you don't even have my device so you obviously don't know that error. :D

I don't really get what you mean. Do you want me to type the command in terminal or change the lines in your swapit script? My English is not that deep lol. What do you mean by
[Android Software/Hacking General [Developers Only]] defiant07:
Do those test commands in terminal please.

To see what I mean do:

busybox | grep cat

and it will return a bunch of results because it does not test for exact matches (i.e. in addition to the line containing "cat" it will also return the lines that contain "lzcat" and "xzcat")...hopefully with one of the test commands you will only get one line of results (i.e. the line containing "cat" and not the lines containing "lzcat" and "xzcat").

Basically by adding '\< and \>' on either side of what you're searching for you get exact matches rather than kinda matches.
[Android Software/Hacking General [Developers Only]] eushaun99:
Okay then...here are my results. The first command didn't gave any output so I added busybox just like the second command and the output is the same now.

u0_a61@android:/ $ su
root@android:/ # mount -o remount,rw /system
root@android:/ # busybox | grep "\<cat\>"
1|root@android:/ # busybox | busybox grep "\<cat\>"
[, [[, ash, awk, base64, basename, blkid, bunzip2, bzcat, bzip2, cal, cat, chat, chattr, chgrp, chmod, chown, chroot, chrt, cksum, clear, comm, cp, crond, crontab, cut, date, dd, depmod, devmem, df, diff,
root@android:/ # busybox | busybox grep '\<cat\>'
[, [[, ash, awk, base64, basename, blkid, bunzip2, bzcat, bzip2, cal, cat, chat, chattr, chgrp, chmod, chown, chroot, chrt, cksum, clear, comm, cp, crond, crontab, cut, date, dd, depmod, devmem, df, diff,
root@android:/ #
[Android Software/Hacking General [Developers Only]] defiant07:
A multitude of thanks...calling busybox did the trick :good:...guess your rom's toolbox grep is weak sauce :p. btw, not that it matters, but did you do busybox | grep cat so you could see the difference?

Try the attached test version please; I aliased grep...it is flashable.
[Android Software/Hacking General [Developers Only]] eushaun99:
Yup it works now.
[Android Software/Hacking General [Developers Only]] defiant07:
Sweet...I will upload it as v9_fix...thanks yet again :highfive:.
[Android Software/Hacking General [Developers Only]] hoholee12:
You can also do this:

busybox | grep -w cat

to get the same result.
[Android Software/Hacking General [Developers Only]] zeppelinrox:
root@android:/ # busybox | grep cat
blockdev, brctl, bunzip2, bzcat, bzip2, cal, cat, catv, chattr, chgrp,
losetup, ls, lsattr, lsmod, lsof, lsusb, lzcat, lzma, lzop, lzopcat,
whoami, xargs, xz, xzcat, yes, zcat
root@android:/ # busybox | grep " cat,"
blockdev, brctl, bunzip2, bzcat, bzip2, cal, cat, catv, chattr, chgrp,
root@android:/ # busybox | grep " awk,"
[, [[, adjtimex, arp, ash, awk, base64, basename, bbconfig, blkid,
root@android:/ #

Search with the preceding space and the trailing comma...

It's not fancy but hey... I'm tired lol

root@android:/ # busybox | grep -w cat
blockdev, brctl, bunzip2, bzcat, bzip2, cal, cat, catv, chattr, chgrp,
root@android:/ # busybox | busybox grep -w cat
1|root@android:/ #

Weird... it doesn't work with busybox grep
[Android Software/Hacking General [Developers Only]] hoholee12:
Works for me...

$ busybox | grep -w cat

cat, chat, chattr, chgrp, chmod,

$ busybox | busybox grep -w cat

cat, chat, chattr, chgrp, chmod,

$
[Android Software/Hacking General [Developers Only]] defiant07:
That was one of the first things I tried...the -w switch does not work on my busybox or toolbox versions of grep.

Which busybox do you use?

Nice trick...did not come across that one...may not be fancy, but it does look cleaner :cool:.

That switch does not work on either of the versions of grep that I have.
[Android Software/Hacking General [Developers Only]] hoholee12:
I use v1.21.1-Stericson

it works on my toolbox too.
[Android Software/Hacking General [Developers Only]] famewolf:
Your new version is giving me a headache.

Okay, first gunna make sure busybox has the

required applets, that you are running as

root, that /etc/init.d exists, and that your

kernel supports swap.

Boss, busybox is complete.

Not Running as Root - No Swap for You!

Bye :p.

69|shell@android:/ # whoami

root