Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 22 Dec 2014, 06:40
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Multimedia
pMusic 4.4.6
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 7 of 125 Posts_count   Goto page: Previous 1, 2, 3, 4, 5, 6, 7, 8, 9, ..., 123, 124, 125 Next
Author Message
zigbert


Joined: 29 Mar 2006
Posts: 5814
Location: Valåmoen, Norway

PostPosted: 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
View user's profile Send_private_message Visit_website 
Michalis

Joined: 08 Jan 2008
Posts: 237
Location: Greece

PostPosted: 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
View user's profile Send_private_message 
zigbert


Joined: 29 Mar 2006
Posts: 5814
Location: Valåmoen, Norway

PostPosted: 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
View user's profile Send_private_message Visit_website 
peppyy


Joined: 27 Jun 2005
Posts: 429
Location: VT USA

PostPosted: 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 Embarassed but I was sure I saw a gtk gui that had a percentage counter.

Of course I could be completely wrong Laughing

_________________
Questions? Search Puppy Linux Answers with Google
Back to top
View user's profile Send_private_message Visit_website AIM YIM MSNM 
zigbert


Joined: 29 Mar 2006
Posts: 5814
Location: Valåmoen, Norway

PostPosted: 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
View user's profile Send_private_message Visit_website 
HairyWill


Joined: 26 May 2006
Posts: 2949
Location: Southampton, UK

PostPosted: 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
View user's profile Send_private_message 
zigbert


Joined: 29 Mar 2006
Posts: 5814
Location: Valåmoen, Norway

PostPosted: 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
View user's profile Send_private_message Visit_website 
zigbert


Joined: 29 Mar 2006
Posts: 5814
Location: Valåmoen, Norway

PostPosted: 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
View user's profile Send_private_message Visit_website 
Michalis

Joined: 08 Jan 2008
Posts: 237
Location: Greece

PostPosted: 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 Confused Rolling Eyes
Back to top
View user's profile Send_private_message 
zigbert


Joined: 29 Mar 2006
Posts: 5814
Location: Valåmoen, Norway

PostPosted: 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
View user's profile Send_private_message Visit_website 
Michalis

Joined: 08 Jan 2008
Posts: 237
Location: Greece

PostPosted: Fri 12 Sep 2008, 15:21    Post_subject:  

So it seems that I didn't help Crying or Very sad

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
View user's profile Send_private_message 
zigbert


Joined: 29 Mar 2006
Posts: 5814
Location: Valåmoen, Norway

PostPosted: 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
View user's profile Send_private_message Visit_website 
zigbert


Joined: 29 Mar 2006
Posts: 5814
Location: Valåmoen, Norway

PostPosted: 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 Wink

Sigmund

_________________
Stardust resources
Back to top
View user's profile Send_private_message Visit_website 
zigbert


Joined: 29 Mar 2006
Posts: 5814
Location: Valåmoen, Norway

PostPosted: 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
View user's profile Send_private_message Visit_website 
Dingo


Joined: 11 Dec 2007
Posts: 1425
Location: somewhere at the end of rainbow...

PostPosted: 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
View user's profile Send_private_message Visit_website 
Display_posts:   Sort by:   
Page 7 of 125 Posts_count   Goto page: Previous 1, 2, 3, 4, 5, 6, 7, 8, 9, ..., 123, 124, 125 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Multimedia
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1250s ][ Queries: 12 (0.0291s) ][ GZIP on ]