Tag Info

New answers tagged

0

You can to try use the timeit module, available in any system with Python: $ python -m timeit "__import__('os').system('my comand here')" 10 loops, best of 3: 591 msec per loop


4

Call time myprogram. This reports wall clock time, user time and system time. User time is the time spent by the process in computations. If the program is multithreaded and the machine has multiple processors, the time spent on all processors is summed (so for a sufficiently parallel program, the user time can be more than the wall clock time). The system ...


3

If you can get the pid, which shouldn't be hard with either ps, /proc/self or $! depending on whether or not you background it you can find this in: /proc/$pid/stat: utime %lu (14) Amount of time that this process has been scheduled in user mode, measured in clock ticks (divide by ...


13

There are DST-free timezone definitions provided which just define the GMT-offset, called Etc/GMT±X: $ date Mon Apr 7 11:08:56 CEST 2014 $ TZ=Etc/GMT-1 date Mon Apr 7 10:09:16 GMT-1 2014 $ Just link/copy the one you need to /etc/localtime and you should be fine and DST-free: $ ln -s /usr/share/zoneinfo/Etc/GMT-1 /etc/localtime Edit: For non-integer ...


0

You need probably define your own Timezone without any DST rules. Look at the source files of the tzdata package which contains the sources of the compiled files in /usr/share/zoneinfo/.


0

Just remove /etc/localtime (or back up it mv /etc/localtime /etc/localtime.back) make a link to your timezone like below: ln -s /usr/share/zoneinfo/Asia/Tehran /etc/localtime


0

$ s=12345678 $ printf '%d:%02d:%02d:%02d\n' $((s/86400)) $((s/3600%24)) $((s/60%60)) $((s%60)) 142:21:21:18 Converting seconds since epoch to a date and time: $ gdate -d @1234567890 '+%F %T' # GNU date 2009-02-14 01:31:30 $ date -r 1234567890 '+%F %T' # BSD date 2009-02-14 01:31:30


1

You must use an dolar sign $ in assignment to TIMEFORMAT: TIMEFORMAT=$'\n\nreal_test\t%5lR\nuser_test\t%5lU\nsys_test\t%5lS' time ls .... real_test 0m0.006s user_test 0m0.000s sys_test 0m0.004s


2

The shell does not interpret any backslashes inside single quotes. If you want backslashes to be interprested use the $'...' construct, as in: TIMEFORMAT=$'\nreal\t%3lR\nuser\t%3lU\nsys\t%3lS' From man bash: Words of the form $'string' are treated specially. The word expands to string, with backslash-escaped characters replaced as ...


3

The command strace can be useful, you can limit the trace to only count -c or a subset of system calls, -e trace=set Trace only the specified set of system calls. The -c option is useful for determining which system calls might be useful to trace. For example, trace=open,close,read,write means to only trace those four ...


20

look at the time man page on your system, some implementations have format options to include I/O, CPU and Memory stats (-f). For instance, GNU time, with -v will show all available info (here on Linux): /usr/bin/time -v ls Command being timed: "ls" User time (seconds): 0.00 System time (seconds): 0.00 Percent of CPU this job got: 0% Elapsed (wall ...



Top 50 recent answers are included