LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 05-30-2012, 12:57 PM   #1
bhargava_y
LQ Newbie
 
Registered: Apr 2012
Posts: 4

Rep: Reputation: Disabled
Application utilization command


I am looking for a command (if available) in linux which can report the usage of a particular application that is installed on the machine.

If a particular application "x" is installed, I would like to know in a period of say past 24 hrs, for how long it has been used.

Regards,
Bhargava
 
Old 05-31-2012, 07:46 AM   #2
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,838

Rep: Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287
in general there is no such command, but in special cases it may exist.
 
Old 05-31-2012, 07:52 AM   #3
bhargava_y
LQ Newbie
 
Registered: Apr 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
through 'ps' or some other command is it possible to know for how long a process or application has been running?
 
Old 05-31-2012, 08:06 AM   #4
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,009
Blog Entries: 5

Rep: Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787
HP sells products for this called Glance (for real time monitoring) Measureware (for historical gathering) and OpenView Performance Monitor which lets you graph the historical information from Measureware. I've not used it on Linux but I believe they have it available. It allows you to group things by application and/or user so you can quickly drill down to those groups. I highly recommend it if you have the money.

Looking for an open source equivalent I ran across Systemtap. I haven't used it but based on what I see on its site I suspect it would be the tool I'd investigate (especially since we use RHEL heavily here and RedHat is one of the supporters of it and it is avaialable in RHEL repositories).

http://sourceware.org/systemtap/wiki/HomePage

Failing that you could do something like get your own data points via a script (e.g. "ps -ef |grep <processname>") that gets key metrics from the output such as cpu time, resident memory etc... and putting that into a data file at regular intervals then you could use that data in a spreadsheet to graph it (or use something like MRTG). You'd probably be better using ps -o and specifying the exact metrics.

Another one that looks interesting is collectl:
http://collectl.sourceforge.net/

Last edited by MensaWater; 05-31-2012 at 08:08 AM.
 
Old 05-31-2012, 08:11 AM   #5
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,838

Rep: Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287
on solaris ps has a format option "etime" to display elapsed time (and stime for starting time), but I cannot find it on linux.
 
Old 05-31-2012, 12:58 PM   #6
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,009
Blog Entries: 5

Rep: Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787
Quote:
Originally Posted by pan64 View Post
on solaris ps has a format option "etime" to display elapsed time (and stime for starting time), but I cannot find it on linux.
Interesting. There are various time factors you can get with "ps -o". Even more interesting is that the man page for ps on my CentOS5 box shows the following that specifically mentions etime:

Quote:
AIX FORMAT DESCRIPTORS
This ps supports AIX format descriptors, which work somewhat like the
formatting codes of printf(1) and printf(3). For example, the normal default
output can be produced with this: ps -eo "%p %y %x %c". The NORMAL codes are
described in the next section.

CODE NORMAL HEADER
%C pcpu %CPU
%G group GROUP
%P ppid PPID
%U user USER
%a args COMMAND
%c comm COMMAND
%g rgroup RGROUP
%n nice NI
%p pid PID
%r pgid PGID
%t etime ELAPSED
%u ruser RUSER
%x time TIME
%y tty TTY
%z vsz VSZ
I ran
Code:
ps -eo "%p %y %x %c %t"
and it output (truncated output shown):
PID TTY TIME COMMAND ELAPSED
1 ? 00:00:01 init 43-00:58:13
2 ? 00:00:05 migration/0 43-00:58:13
3 ? 00:00:00 ksoftirqd/0 43-00:58:13
4 ? 00:00:00 watchdog/0 43-00:58:13
5 ? 00:00:05 migration/1 43-00:58:13
6 ? 00:00:00 ksoftirqd/1 43-00:58:13
7 ? 00:00:00 watchdog/1 43-00:58:13
 
Old 06-03-2012, 07:19 AM   #7
markseger
Member
 
Registered: Jul 2003
Posts: 241

Rep: Reputation: 25
Turn on collectl and let it run for awhile (though once you turn it on there's no reason to ever turn it off ).

You can then play back the recorded data and look at how much time a process had used 24 hours ago and then again right now and the difference will tell you what you want to know.

-mark
 
  


Reply

Tags
application, command, monitor, utilization


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
make command for an application aa.bb.cc Programming 4 07-21-2010 07:27 AM
command line cpu utilization ninja master Linux - Software 1 04-24-2010 04:41 PM
Total CPU utilization returned by "top" command sanpnair Linux - Newbie 1 05-15-2009 12:19 PM
Linux desktop GUI tool for CPU utilization and bandwidth utilization karimasif Linux - Software 4 03-03-2008 01:09 PM
command application problem mkingiii Programming 4 10-27-2006 12:24 AM


All times are GMT -5. The time now is 03:39 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration