Jump to content

Recommended Posts

Phellow Phreaks!
I'm trying to track the CPU usage of a short Linux script that I wrote called clientFeeder.do.  I want to grep out the system cpu time and log it into a file.  However, when I run the command:

time . clientFeeder.do >> grep sys 2>&1

I get all three times, real, user, and sys.

real    0m1.685s
user    0m0.033s
sys    0m0.027s

Can anyone tell me what I'm doing wrong?  ???  I just want the sys time, not the other two lines.  Thanks!

Warm regards,
James
Link to comment
https://forums.phpfreaks.com/topic/31314-grepping-the-linux-time-command/
Share on other sites

well, you're close, but not quite - the syntax would actually be:

[code]$ time foobar 2>&1 | grep sys[/code]

It's odd, though - grep still doesn't seem to catch it, when I try it. Other stderr redirection works fine for me, but not with time. I suspect it's because time is a utility within bash, and that throws things off, for whatever reason.
  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.