LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Closed Thread
 
LinkBack Search this Thread
Old 02-15-2006, 05:20 PM   #1
psmech
LQ Newbie
 
Registered: Feb 2006
Posts: 2

Rep: Reputation: 0
Question time and memory limits


Hi,
Is there any easy way to run particular program and count the time it is working and watch the use of memory?
For example I want to end this program if it lasted more than 5 seconds or used more than 1MB of memory.
I wonder if it could be done only in bash...

Thanks,
Arthur
 
Old 02-15-2006, 05:24 PM   #2
Vgui
Member
 
Registered: Apr 2005
Location: Canada
Distribution: Slackware
Posts: 496

Rep: Reputation: 31
Not sure about memory usage, maybe strace has something you could use, or taking a "snapshot" of free before and after running the program. For program runtime, just use the "time" command, such as
Code:
time xterm -e firefox
Once the program has exited, it will print the time (both user and system) the application used.

Hope that helps.
 
Old 02-15-2006, 06:07 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,623
Blog Entries: 10

Rep: Reputation: 773Reputation: 773Reputation: 773Reputation: 773Reputation: 773Reputation: 773Reputation: 773
Quote:
Originally Posted by psmech
Hi,
Is there any easy way to run particular program and count the time it is working and watch the use of memory?
For example I want to end this program if it lasted more than 5 seconds or used more than 1MB of memory.
I wonder if it could be done only in bash...

Thanks,
Arthur
Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

http://www.linuxquestions.org/rules.php

The original lives here:
http://www.linuxquestions.org/questi...d.php?t=415865

and this thread has been reported for closure.
 
  


Closed Thread


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
controlling time and memory psmech Programming 6 07-25-2006 12:44 AM
login attempts to web-page. (time limits) ldp Linux - Security 2 01-20-2005 12:42 PM
user account time limits DAChristen29 Linux - Networking 2 12-24-2004 06:00 PM
array size/C++ memory limits for user space programs? thrifteed Programming 4 09-05-2004 04:42 AM
Traffic and time limits for internet users. pamsi Red Hat 0 12-15-2003 10:05 AM


All times are GMT -5. The time now is 12:12 AM.

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
Open Source Consulting | Domain Registration