The time now is Thu 20 Jun 2013, 00:32
All times are UTC - 4 |
|
Page 7 of 113 [1694 Posts] |
Goto page: Previous 1, 2, 3, 4, 5, 6, 7, 8, 9, ..., 111, 112, 113 Next |
| Author |
Message |
zigbert

Joined: 29 Mar 2006 Posts: 5295 Location: Valåmoen, Norway
|
Posted: Sun 07 Sep 2008, 06:44 Post subject:
|
|
Michalis
I noticed today that my pmusic had 3 instances of func_progressbar running at the same time. I have done an approach to try to fix it, but it is a bit too early to ship a new release. Can you try to explain why progressbar is hungry for your resources.
- Are your machinery old?
- Does 'top' show that progressbar stealing too much cpu?
- Are there several func_progressbar shown in pprocess?
- Are you using the latest Pmusic - version 0.3.0?
- Is it Puppy 4.1 or ... ?
I disable progressbar on my music-station to avoid fan is running constantly (a PIII 600 laptop anno 1999).
Edit: Version 0.3.0 reduces the cpu-priority for func_progressbar.
Sigmund
_________________ Stardust resources
|
|
Back to top
|
|
 |
Michalis
Joined: 08 Jan 2008 Posts: 237 Location: Greece
|
Posted: Sun 07 Sep 2008, 07:27 Post subject:
|
|
I'm running pmusic 0.3.0 in puppy 3.1
The machine I usually use is old, also I use many programs simultaneously, at least 4-5 (usually much more). When having the progress bar pmusic cpu usage is doubling and generally I like to use programs and functions as less resource hungry as possible, so I have always progress bar disable. A strange thing is that the system isn't showing any difference at pmusic's cpu usage, but I can see that throughout the total cpu usage every time.
Anyway, what I would like isn't a progress bar using less resources (actually I don't mind whether I see a progress bar or not) rather than just to see the title of the song which is playing (statically) in the position of the progress bar.
|
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 5295 Location: Valåmoen, Norway
|
Posted: Sun 07 Sep 2008, 09:00 Post subject:
|
|
| Quote: | | A strange thing is that the system isn't showing any difference at pmusic's cpu usage, but I can see that throughout the total cpu usage every time. | The progressbar runs as an unique process.
| Quote: |
Anyway, what I would like isn't a progress bar using less resources (actually I don't mind whether I see a progress bar or not) rather than just to see the title of the song which is playing (statically) in the position of the progress bar. | I have tried get this, but either I'm not skilled enough, or the limitation in the gtkdialog library are strict.
Sigmund
_________________ Stardust resources
|
|
Back to top
|
|
 |
peppyy

Joined: 27 Jun 2005 Posts: 429 Location: VT USA
|
Posted: Wed 10 Sep 2008, 01:14 Post subject:
|
|
Hi again Zidbert.
Is there a chance that the progress bar could be replaced with a text counter which uses percent? I don't understand how the whole dialog works but I was sure I saw a gtk gui that had a percentage counter.
Of course I could be completely wrong
_________________ Questions? Search Puppy Linux Answers with Google
|
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 5295 Location: Valåmoen, Norway
|
Posted: Wed 10 Sep 2008, 02:05 Post subject:
|
|
If you could active send a percent status to that textbox, it would be easy. But since the Pmusic gui has nothing to do with the actual playback, it only reads outputs from the player. As far as I know, the only way gtkdialog supports an idle gui (no user activity) waiting for system input is via the pregressbar widget.
I don't think a textbox would use lesser cpu. The problem is not the progressbar widget itself, but that pmusic constantly runs a loop to check for new outputs from ffpmeg. If the output of ffmpeg could be used directly in Pmusic progressbar, this wouldn't be necessary.
Sigmund
_________________ Stardust resources
|
|
Back to top
|
|
 |
HairyWill

Joined: 26 May 2006 Posts: 2949 Location: Southampton, UK
|
Posted: Wed 10 Sep 2008, 04:37 Post subject:
|
|
| Code: | | while [ a != b ]; do if [ "`cat '"$WORKDIR"'/pmusic-ffmpeg_output`" ]; then nice -18 '"$APPDIR"'/func_progressbar; usleep 100000; fi; done | Zigbert as I copied this approach in psip I have a couple of suggestions.
Do you really need to poll 10 tens a second surely twice a second would be adequate, even less if all you display is the title?
I changed the while condition to something like
while [ "$(ps | grep [p]music)" ]
this should help to ensure that the loop terminates properly when all the other pmusic processes are closed.
_________________ Will
contribute: community website, screenshots, puplets, wiki, rss
|
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 5295 Location: Valåmoen, Norway
|
Posted: Wed 10 Sep 2008, 09:22 Post subject:
|
|
HairyWill
1. while [ "$(ps | grep [p]music)" ] is a great improvement. I will add it at once.
2. usleep 100000 gives a smooth 'clock' in the bar. But it could be an option to update the progressbar every 2 seconds instead of hiding the progressbar.
Thanks for great feedback.
Sigmund
_________________ Stardust resources
|
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 5295 Location: Valåmoen, Norway
|
Posted: Wed 10 Sep 2008, 15:47 Post subject:
|
|
It seems to me that the actual cpu-eater is the while-loop started inside gtkdialog. I tried to set nice -18 in front of 'while', but no joy.
Sigmund
_________________ Stardust resources
|
|
Back to top
|
|
 |
Michalis
Joined: 08 Jan 2008 Posts: 237 Location: Greece
|
Posted: Thu 11 Sep 2008, 10:53 Post subject:
|
|
I think that I managed to make something which with your knowledge maybe you can make it even better
First of all I changed:
| Code: | | while [ a != b ]; do if [ "`cat '"$WORKDIR"'/pmusic-ffmpeg_output`" ]; then nice -18 '"$APPDIR"'/func_progressbar; usleep 100000; fi; done |
To
| Code: | | while [ "$(ps | grep [p]music)" ]; do if [ "`cat '"$WORKDIR"'/pmusic-ffmpeg_output`" ]; then nice -18 '"$APPDIR"'/func_progressbar; usleep 100000; fi; done |
according to HairyWills' suggestion
Then I copied and renamed func_progressbar file to a new one called func_noprogressbar in the same directory.
Afterwards I did some cleaning in the file and so this is what is now left:
| Code: | #!/bin/bash
WORKDIR=$HOME/.pmusic/tmp
#show tool-info instead of song
TMP=`cat $WORKDIR/pmusic-PERCENT_BAR`
case "`cat $WORKDIR/pmusic-progressbar_status`" in
undo) echo $TMP; echo 'Go BACK in playlist history'; exit ;;
redo) echo $TMP; echo 'Go FORWARD in playlist history'; exit ;;
esac
#make sure to give some output
if [ "`cat $WORKDIR/pmusic-ffmpeg_output`" = "pmusic_stop" ] || [ ! "`cat $WORKDIR/pmusic-ffmpeg_output`" ]; then
echo " " > $WORKDIR/pmusic-OLD_TIME
echo 0
echo "»»» Pmusic «««"
else
#read ffmpeg output
FILE=`cat $WORKDIR/pmusic-ffmpeg_output | grep "from '" | cut -d "'" -f 2- | sed -e "s/'://g"`
#show metainfo of file if exist. (in indexlist)
FILE2="`cat $HOME/.pmusic/index_all | grep -w "$FILE" | cut -d '|' -f 2`"
if [ "$FILE2" ]; then FILE="$FILE2"; fi
#---
NOW_PLAYING=`basename "$FILE" 2> /dev/null | sed -e 's/\.[^\.]*$//'`
FFMPEG_OUTPUT=`tail -c 120 $WORKDIR/pmusic-ffmpeg_output` #check for invalid output
if [ "$FILE" ] && [ ! "`echo "$FFMPEG_OUTPUT" | grep 'invalid'`" ]; then # expr + 1 checks if it's a number
#find percent for progress bar
#calculate time of seconds played
if [ `echo $NOW_PLAYING | cut -b 1` -lt 9 2> /dev/null ]; then #first char is a number. This bugs progress bar.
echo "| $NOW_PLAYING |"
else
echo "$NOW_PLAYING "
fi
#keep values incase of invalid output next loop
else #no time is detected
cat $WORKDIR/pmusic-PERCENT_BAR
if [ "$FILE" ]; then
echo "$NOW_PLAYING$TMP"
else
echo "»»» Pmusic «««"
fi
fi
fi
exit 0 |
then I changed pmusic to:
| Code: | if [ $SHOW_PROGRESS_BAR = true ]; then
GUI_PROGRESS_BAR="
<progressbar>
<label>\" \"</label>
<input>"'while [ "$(ps | grep [p]music)" ]; do if [ "`cat '"$WORKDIR"'/pmusic-ffmpeg_output`" ]; then nice -18 '"$APPDIR"'/func_progressbar; usleep 100000; fi; done'"</input>
</progressbar>"
else
GUI_PROGRESS_BAR="
<progressbar>
<label>\" \"</label>
<input>"'while [ "$(ps | grep [p]music)" ]; do if [ "`cat '"$WORKDIR"'/pmusic-ffmpeg_output`" ]; then nice -18 '"$APPDIR"'/func_noprogressbar; usleep 1000000; fi; done'"</input>
</progressbar>"
fi |
So what have I achieved from that?
I can see only the title without the red progress bar and the time.
What haven't I achieved from that?
No significant reduction in the cpu usage. That's maybe because the cleaning is very primitive and because of lack of knowledge I have produced many mistakes which I can see when running pmusic from console and in kp.
Maybe If you can fix those problems then you could achieved what we are asking? Not sure I just hope I gave you some help, or I at least I want to believe so
|
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 5295 Location: Valåmoen, Norway
|
Posted: Fri 12 Sep 2008, 02:23 Post subject:
|
|
Michalis
Thanks a lot for your investigating.
My conclusion (at this moment) is that; it doesn't matter how much we strip func_progressbar. Running this function once a second or 10 times a second shouldn't steal much cpu even on older systems. The problem seems to be the 'while' loop itself. It's running constantly, and sleep/func_progressbar doesn't seem to affect the cpu hunger. (Please correct me if I'm wrong.) Why it acts like this is a mystery for me. I'm not a skilled person, so it could be just me. Like I told in my previous post, I have also tried to set a lower cpu-priority with 'nice' in front of the 'while' loop. But either is it not allowed, or I didn't fixed the syntax?
Sigmund
_________________ Stardust resources
|
|
Back to top
|
|
 |
Michalis
Joined: 08 Jan 2008 Posts: 237 Location: Greece
|
Posted: Fri 12 Sep 2008, 15:21 Post subject:
|
|
So it seems that I didn't help
| zigbert wrote: | | My conclusion (at this moment) is that; it doesn't matter how much we strip func_progressbar. Running this function once a second or 10 times a second shouldn't steal much cpu even on older systems. The problem seems to be the 'while' loop itself. It's running constantly, and sleep/func_progressbar doesn't seem to affect the cpu hunger. (Please correct me if I'm wrong.) |
I'm not so sure about it, at least according to what I've seen in my system. Changing how often the "while fuction would be running, by changing the usleep parameter, I noticed that when the fuction was running I had a significant increase to the cpu usage. It was noticed in conky with sort spikes in the cpu usage graph.
Because of that what I tried to do is to reduce what the fuction was doing when running. So I deleted everything that had to do with time calculation and also made the loop run every 2 seconds, this makes it to just read the title output from ffmpeg and thus to use less cpu power.
Of course at the end as I've already told you I haven't any programming knowledge and I'm not sure if I'm correct or totally wrong also. But I think it would be better to keep your opinion and try to find solution over it.
|
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 5295 Location: Valåmoen, Norway
|
Posted: Fri 12 Sep 2008, 15:38 Post subject:
|
|
Michalis
Could you measure what the difference is on your system, if func_progressbar is empty compared to the original.
Thanks
Sigmund
_________________ Stardust resources
|
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 5295 Location: Valåmoen, Norway
|
Posted: Sat 13 Sep 2008, 09:43 Post subject:
|
|
I have used 'top' to measure cpu usage, and couldn't see much difference. Now I have installed conky which shows dramatical differences. Which one is to trust?
Conky resut when running only Pmusic on my system:
66% - Normal
18% - No func_progressbar
23% - While-loop with sleep 1
9% - No progresbar
If conky is to trust, I have something to investigate
Sigmund
_________________ Stardust resources
|
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 5295 Location: Valåmoen, Norway
|
Posted: Sat 13 Sep 2008, 15:20 Post subject:
|
|
Version 0.3.1 is uploaded
See main post
cpu-usage on my system (conky):
3% - Idle
9% - Pmusic without progress bar
18% - Pmusic 0.3.1
37% - Gxine
66% - Pmusic 0.3.0
There is still a potential for even more cpu reduction. Let's take a look at the code in some time ... when we've learned more...
Sigmund
_________________ Stardust resources
|
|
Back to top
|
|
 |
Dingo

Joined: 11 Dec 2007 Posts: 1398 Location: somewhere at the end of rainbow...
|
Posted: Sat 13 Sep 2008, 16:55 Post subject:
|
|
do you think to add a language support?
_________________ replace .co.cc with .info to get access to stuff I posted in forum
dropbox 2GB free
OpenOffice for Puppy Linux
|
|
Back to top
|
|
 |
|
|
Page 7 of 113 [1694 Posts] |
Goto page: Previous 1, 2, 3, 4, 5, 6, 7, 8, 9, ..., 111, 112, 113 Next |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|