Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

[bash] time -f "%U+%S"

Name: Anonymous 2011-01-25 8:02

Hi,

I want to evaluate the total CPU time of a process (user + system). So basically, time.txt -f "%U+%S"
But -f doesn't evaluate the sum.

I had to do :
/usr/bin/time -o time.txt -f "%U+%S" ./a.out ; cat time.txt | bc ; rm time.txt

Any idea to perform that, without a temporary file?

Name: Anonymous 2011-01-25 8:22

curl 'http://www.math.sc.edu/cgi-bin/sumcgi/calculator.pl?fx='`/usr/bin/time -f %U+%s ./a.out 2>&1 | perl -e 'my $strno = 0; while (<>) { next unless $strno++ == 3; print;}' | sed 's/\+/%2B/g'` 2>/dev/null | grep H5 | sed -r 's;^.*?<H5>(.*?)</H5>.*;\1;'

Name: Anonymous 2011-01-25 8:29

green text

Name: Anonymous 2011-01-25 8:48

Thank you! You make my day.

I didn't think about 2>&1 and you learn me several tricks with sed.

Name: THE ONE WHO HELPED HIM 2011-01-25 8:56

/usr/bin/time -f "%U + %S" touch . 2>&1 | bc

Name: Anonymous 2011-01-25 9:08

Indeed, it's simpler with bc.

Have a nice day

Name: Anonymous 2011-01-25 10:50

Really? You didn't think about pipe redirection? Even though you've already done it, and with cat no less.

Name: Anonymous 2011-01-25 15:46

>>7
I have a feeling that YHBT

Name: Anonymous 2011-01-25 15:47

>>1
Make the temporary file on a ramdisk to avoid excessive disk IO which wears out your disks.

Name: Anonymous 2011-01-26 5:11

>>9
And here you are, implying that we should be wearing out our rams instead. Hypocrisy is what it is.

Name: Anonymous 2011-01-26 5:12

noko
Fuck, Sussman, stop trolling.

Name: Anonymous 2011-01-26 12:12

>>11
Nokoing is considered polite in /prog/.

Name: sage !sageL4x7a6 2011-01-26 12:13

>>12
sage

Name: noko 2011-01-26 14:54

noko

Name: Anonymous 2011-01-26 14:59

neko

Name: Anonymous 2011-01-26 15:04

Name: Anonymous 2011-02-04 19:35

Name: Anonymous 2013-09-01 23:12


The notion of cardinality, as now understood, was formulated by Georg Cantor, the originator of set theory, in 1874–1884. Cardinality can be used to compare an aspect of finite sets; e.g. the sets {1,2,3} and {4,5,6} are not equal, but have the same cardinality, namely three (this is established by the existence of a one-to-one correspondence between the two sets; e.g. {1->4, 2->5, 3->6}).

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List