maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [Announce][Fremantle] FlopSwap - Swap GUI Management (https://talk.maemo.org/showthread.php?t=87985)

sixwheeledbeast 2012-11-23 20:30

[Announce][Fremantle] FlopSwap - Swap GUI Management
 
4 Attachment(s)
FlopSwap is a concept taken from a few scripts built in the community to aid in manually controlling swaps.

For full information see wiki page.

http://wiki.maemo.org/Flopswap

HELLASISGREECE 2012-11-23 20:36

Re: [Pre-Announce][Fremantle] FlopSwap - Swap GUI Management
 
Can you elaborate a bit more?
For us noobs.

Tiran 2012-11-23 20:49

Re: [Pre-Announce][Fremantle] FlopSwap - Swap GUI Management
 
sixwheeledbeast@ FlopSwap it is the new program??? Write here more in detail!

tortoisedoc 2012-11-23 20:57

Re: [Pre-Announce][Fremantle] FlopSwap - Swap GUI Management
 
Just setup a Nokia project page? It worked for me :P

MINKIN2 2012-11-23 21:00

Re: [Pre-Announce][Fremantle] FlopSwap - Swap GUI Management
 
Got teaser video to share?

sifo 2012-11-23 21:01

Re: [Pre-Announce][Fremantle] FlopSwap - Swap GUI Management
 
So you created the thread before anybody else announce your new app :p
hopefully waiting for it :)

Tiran 2012-11-23 21:04

Re: [Pre-Announce][Fremantle] FlopSwap - Swap GUI Management
 
Continuous intrigue! :) :) :)

sixwheeledbeast 2012-11-23 21:10

Re: [Pre-Announce][Fremantle] FlopSwap - Swap GUI Management
 
Teaser screenshot added.
Anybody would think you haven't seen an [Announce] thread in two weeks.
Thanks for the intrigue.

peterleinchen 2012-11-23 21:39

Re: [Pre-Announce][Fremantle] FlopSwap - Swap GUI Management
 
@six
What is your basis?
swapset? ereswap? self-made script?
Or will you combine all the goodies?

sixwheeledbeast 2012-11-23 22:34

Re: [Pre-Announce][Fremantle] FlopSwap - Swap GUI Management
 
Quote:

Originally Posted by peterleinchen (Post 1297688)
@six
What is your basis?
swapset? ereswap? self-made script?
Or will you combine all the goodies?

Updated OP, feedback welcome.... :)

This is not a GUI for a old program it's a separate application.

mr_pingu 2012-11-23 23:36

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Do I need to have 3 swaps? That part isn't clear to me

I only have them on
/dev/mmcblk0p3 and /dev/mmcblk1p2

Is a third really needed or would this suffice?

peterleinchen 2012-11-23 23:47

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Cannot (yet ;)) answer for his app, but I assume after all the discussions that he is swappingthe swap space from one SD swap to the other SD swap, so that there is only one (exactly one: SD1 -> SD2) swap movement; hereby avoiding one full writing of swap memory, as it was done before (SD->eMMC->SD).
The third (internal) eMMC swap is just left untouched, as long as you have your SD card in. If there is the need for removing it, you may enable that internal swap again, so you have the chance to do this with a running system.

@sixwheelebeast
Please correct me, if I am wrong. Did not yet look into your sources.
But this is how I do it.

One question: do you also check swap usage and allow a automated swap refreshing (e.g. after 90% fill level)?

sixwheeledbeast 2012-11-24 09:37

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Quote:

Originally Posted by mr_pingu (Post 1297714)
Do I need to have 3 swaps? That part isn't clear to me

I only have them on
/dev/mmcblk0p3 and /dev/mmcblk1p2

Is a third really needed or would this suffice?

@mr_pingu
Yes, exactly as per peterleinchen.
A swap space is required at all three locations in the OP.
This is important as currently there is no way "GUI friendly way" to edit swaps and if you try to swapon to a FAT partition the system will reboot.

I wanted to move away from device swap completely to remove flash wear.
0p3 is only used as a backup (this is used when pressing Unmount).
1p2 and 1p3 flip over (only one swapon/swapoff) everytime you press Fresh Swap.

Also if swap is on 0p3 and you press fresh swap it will automatically swap you to 1p2, but never go back to 0p3 unless you press the Unmount button.

@peterleinchen
Currently no this is only a quicker manual way of editing swaps to save me open terminal all the time. However I do plan to turn it into a more complete swap manager.

Plans
*Put a new upstart file in event.d, this is to push swap to 1p2 or fallback to 0p3.
*Adding an alarm_queue event with selectable time.

If you want to read or edit the back end have a dig in /opt/flopswap

sixwheeledbeast 2012-11-24 21:29

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Bump new version 0.0.2 with very useful "Swap on SD at Boot"

This adds/removes a file called relocateswap to /etc/event.d
If checked this will automatically put swapon /dev/mmcblk1p2 after rcs-late.

Very pleased as this is my first checkBox with code I have done. :)

All information in OP new QRCode too!


Any devs got any ideas how to add an event to the alarm_queue or some way of automatically reswapping?

jukra 2012-11-28 21:41

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
What the swap? No more manual swap defragging as I used to do. :) Excellent! This works like a charm when setup as described in OP.

sixwheeledbeast 2012-11-28 23:22

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Quote:

Originally Posted by jukra (Post 1299498)
What the swap? No more manual swap defragging as I used to do. :) Excellent! This works like a charm when setup as described in OP.

Glad I have a happy user.

I have a tiny update that I am working on, I have mapped the "QWAS" keys to the buttons in the application.
This works well, however I still want to test it and work on finding a solution for swapping on a timer; before a new release.

peterleinchen 2012-11-28 23:25

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Quote:

Originally Posted by sixwheeledbeast (Post 1297982)
Any devs got any ideas how to add an event to the alarm_queue or some way of automatically reswapping?

Hey sixwheeler,
just saw your beg.
If it helps you I may send you my script, which checks swap usage cyclically and at a certain border calls a defrag script. I have rewritten it a bit a few months ago, so it may match your needs (you will need some conf files in /tmp/ swapdev, swapsize, swapinuse, which deine the current swap configuration. Done it that way as I have another script checking which swaps to activate according to SD in/out/...).

sixwheeledbeast 2012-12-01 19:57

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
New version released (0.0.3).
Tried the autobuilder to no avail, so get scanning that QRCode. :)

New goodies are:-
*A new button to check swap usage (free | grep Swap)
*Key mappings for the four main buttons on "QWAS" keys.

See OP for full details, happy flopswapping!

peterleinchen 2012-12-01 20:30

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Quote:

Originally Posted by sixwheeledbeast (Post 1300416)
... Tried the autobuilder to no avail, ...

I do not understand why it works for some and for others not :confused:

Quote:

Originally Posted by sixwheeledbeast (Post 1300416)
A new button to check swap usage (free | grep Swap)

But you can not rely at all on that info for swap defrag!
It just shows the amount of used swap. This will be something from a few MB up to a few 100MB.
But it will not show the already written amount on that swap space. This info can be fetched via iostat (withh bb-power) or more sophisticated with following script (rely on the number of bytes, please):
Code:

#!/bin/sh
disk=mmcblk0p3

blocks=$(awk '{if ($3=="'"$disk"'") print $10}' /proc/diskstats)
echo $blocks blocks
let bytes=$blocks*512
echo $bytes bytes
let kb=$bytes/1024
let mb=$bytes/1024/1024
let gb=$bytes/1024/1024/1024
echo $kb kb, $mb mb, $gb gb


sixwheeledbeast 2012-12-01 20:42

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Quote:

Originally Posted by peterleinchen (Post 1300423)
But you can not rely at all on that info for swap defrag!
It just shows the amount of used swap. This will be something from a few MB up to a few 100MB.
But it will not show the already written amount on that swap space. This info can be fetched via iostat (withh bb-power) or more sophisticated with following script (rely on the number of bytes, please):

I did realise that but I didn't want to depend on bbpower.
I didn't want to force people to have install dependenices for this to work.
However I like the look of your script (I didn't think of using diskatats) maybe I can re-jig it about to me more useful.

peterleinchen 2012-12-01 21:01

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Yeah, do so please. :) As this script does not depend on anything.
And name the output something like "swap amount written". Or make it a percentage value (even bettter :)).

sixwheeledbeast 2012-12-01 21:14

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Quote:

Originally Posted by peterleinchen (Post 1300443)
Yeah, do so please. :) As this script does not depend on anything.
And name the output something like "swap amount written". Or make it a percentage value (even bettter :)).

I have changed the disk part to get the current swap partition.
Code:

disk=$(cat /proc/swaps | awk '/dev/ {print $1}' | cut -d "/" -f 3)
This outputs the current partition without the "/dev/" part "mmcblk1p2" and fits it perfect.

But where do I get the total number of bytes to get a percentage?
A percentage will be easier to work off as this doesn't limit you to a particular swap size.

peterleinchen 2012-12-01 21:37

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Quote:

Originally Posted by sixwheeledbeast (Post 1300448)
Code:

disk=$(cat /proc/swaps | awk '/dev/ {print $1}' | cut -d "/" -f 3)
This outputs the current partition without the "/dev/" part "mmcblk1p2" and fits it perfect.

OK.


Quote:

Originally Posted by sixwheeledbeast (Post 1300448)
But where do I get the total number of bytes to get a percentage?

What about:
Code:

awk '{if ($1=="'"/dev/$disk"'") print $3}' /proc/swaps
in your notation.

P.S.: as I have more than one swap online (I know I know), I needed to get the one out of them, You seem to have only one online at a time.
Sorry for delay, had a batt shutdown.

sixwheeledbeast 2012-12-01 22:22

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
OK. Sorry I got you now. D'oh

cat /proc/swaps get the bytes from there.

sixwheeledbeast 2012-12-11 19:34

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Updated to Version 0.0.4

Changes / QR code / Download in OP

This update now makes Flopswap do what I intended.
After some fun with ash and some help from others here, I have now made Flopswap able to monitor Swap defragmentation.

This update now makes Flopswap have all the functionally of Ereswap with the added benifits of:-

*Being optified and not installing files in /sbin and /root that don't get removed on uninstallation.

*Not modifing rcs-late at all (you may wish to return your rcs-late to it's pre-ereswap form).

*Not depending on anything, like busybox-power or iostat for example.

*GUI

While not looking like much of an update there have been a fair few changes in the code and scripts.
I have been testing it on two devices for the last week to make sure it stable and functional.

Happy Swapping.

pierrem 2012-12-11 21:19

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Thanks for this useful tool
What about integrating compcache ?

sixwheeledbeast 2012-12-12 00:39

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Quote:

Originally Posted by pierrem (Post 1303602)
What about integrating compcache ?

I don't use it myself.
To benefit from compcache you need to modify VM settings to swap more. Also using ramz will reduce battery life, due to compressing and uncompressing.

I personally don't see much benefit, compared with thumb for example, so will leave compcache to the "swapset"application.

ivgalvez 2012-12-12 08:16

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Would you try to upload it to the repos? At least the dput method is still working.

sixwheeledbeast 2012-12-12 13:48

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Quote:

Originally Posted by ivgalvez (Post 1303700)
Would you try to upload it to the repos? At least the dput method is still working.

I would love to put it in the repos.
I have been trying scp everyday for the last couple of weeks.

mr_jrt 2012-12-12 14:51

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Intriguing...have to check this out later. Been away from my Maemo hacking for far too long...hence the lack of updates to swapset ;)

...incidentally, has any effort been made by those versed in kernel-power to fix the fragmentation problem at source i.e. in the kernel?

sixwheeledbeast 2012-12-12 19:26

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Quote:

Originally Posted by ivgalvez (Post 1303700)
Would you try to upload it to the repos?

Code:

crunch@crunch:/opt/QtSDK/builds/flopswap_build_0.0.4$ scp flopswap_0.0.4.tar.gz flopswap_0.0.4_source.changes flopswap_0.0.4.dsc sixwheeledbeast@drop.maemo.org:/var/www/extras-devel/incoming-builder/fremantle/
Permission denied (publickey).
lost connection
crunch@crunch:/opt/QtSDK/builds/flopswap_build_0.0.4$

Just tried again.
A TMO member has kindly offered to put applications in the repos for me.
The issue is I can't easily maintain anything myself if there is a issue found in FlopSwap.
While I know how much of a pain it is, I would prefer to be able to provide updates myself from here for the short term.

As soon as I can upload to the repos effectively it will be there.

misiak 2012-12-12 20:35

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
I was messaging with ade, he also had some issues with uploading to the repos via scp, he pointed out that you can't use uppercase or underscores in the package name (could this be the issue in here, too?)

sixwheeledbeast 2012-12-12 20:45

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Quote:

Originally Posted by misiak (Post 1303925)
could this be the issue in here, too?

Just renamed the files and tried again, same error.
Was worth a go, I am confident it's setup in garage correct.
Thanks anyway.

ade 2012-12-12 20:46

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Nah, sixwheeledbeast's issue is the permission to upload itself, as the key is not accepted.

Xagoln 2012-12-17 23:23

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
@sixwheeledbeast, how about making your app able to accept a command on the command line. Then we can all automate switching swap partitions using cron or alarmed or any other way we choose.

i.e. just add an optional one word argument to flopswap for the actions the main buttons do. If the app receives one of these arguments, it might do a quick sanity check and then action and exit, without displaying the GUI.

Later you can still add your own means of setting up automated switching from inside flopswap. What do you think?

sixwheeledbeast 2012-12-18 08:42

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Quote:

Originally Posted by Xagoln (Post 1305533)
@sixwheeledbeast, how about making your app able to accept a command on the command line. Then we can all automate switching swap partitions using cron or alarmed or any other way we choose.

What do you think?

Have you looked in /opt/flopswap/script/ :)

Remember at the moment this is a GUI to run scripts, all the scripts in this file should run from CLI, with application open or not.
However I wouldn't press a button and fire a CLI command at the same time.
The application is written in a way that QProcess shouldn't allow two buttons to run at the same time.


To Switch Swaps
Code:

sh /opt/flopswap/script/swapswitch.sh

sixwheeledbeast 2013-01-18 22:39

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Wiki page created, most of OP moved there.
Still waiting for garage to be stable, so still use the QRc in OP.
Thanks.

saponga 2013-01-24 22:19

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Flopswap doesn't show me the "swap status" anymore. It used to works fine until last week. I don't know what i did but im getting this:
Code:

$ sh /opt/flopswap/script/swapused.sh
ublocks
/opt/flopswap/script/swapused.sh: line 38: arithmetic syntax error

All others commands are working ok. I already did uninstall and reinstall but no joy. Here is the line 38:
Code:

ubytes=$(($ublocks*512))
Could someone help me to debbug that ?
Thanks.

sixwheeledbeast 2013-01-24 22:51

Re: [Announce][Fremantle] FlopSwap - Swap GUI Management
 
Quote:

Originally Posted by saponga (Post 1317487)
Flopswap doesn't show me the "swap status" anymore. It used to works fine until last week. I don't know what i did but im getting this:
Code:

$ sh /opt/flopswap/script/swapused.sh
ublocks
/opt/flopswap/script/swapused.sh: line 38: arithmetic syntax error

All others commands are working ok. I already did uninstall and reinstall but no joy. Here is the line 38:
Code:

ubytes=$(($ublocks*512))
Could someone help me to debbug that ?
Thanks.

I had this before, it's due to busybox.

Out interest what's your uptime?

Two things to try if you can please.

Install bash and edit the script to run with "bash" instead of sh, this should make it work again.

Turn the script back to "sh" and reboot, this should also make the script work again.

saponga 2013-01-24 23:06

Thanks man... I'll do that as soon as i could get a PC.
About the uptime:
$ uptime
21:01:50 up 1 day, 1:22, 0 users, load average: 0.08, 0.43, 0.47
i'll report back. Thanks again.


All times are GMT. The time now is 15:06.

vBulletin® Version 3.8.8