Re: wall-clock time profiling
In article [EMAIL PROTECTED], Bill Campbell [EMAIL PROTECTED] writes: freebsd On Thu, May 31, 2007, Akihiro KAYAMA wrote: freebsd In article [EMAIL PROTECTED], freebsd Chuck Swiger [EMAIL PROTECTED] writes: freebsd freebsd cswiger Akihiro KAYAMA wrote: freebsd cswiger Hi all. freebsd cswiger freebsd cswiger What is the right way to measure wall-clock time in profiling on FreeBSD? freebsd cswiger freebsd cswiger The time shell builtin command or /usr/bin/time -l _program_? freebsd cswiger freebsd cswiger The latter variant displays the rusage struct (ie, from man getrusage)? freebsd freebsd Thanks for your response. freebsd freebsd Yes, we can know whether the program is I/O bound or CPU bound by freebsd time(1). But it is still unclear which part of the program is really freebsd waiting for I/O. So profiling is needed for tuning, although CPU time freebsd profiling gives me non-distinct result on I/O bound programs. It is freebsd reason why I want wall-clock time profiling. freebsd freebsd Wall clock time doesn't generally tell you anything reliably freebsd useful on a multi-tasking system as it's very dependent on other freebsd system activity. I had many fights back in the mid '70s with freebsd people in accounting who wanted to bill wall-clock time on freebsd Burroughs main frames which generally had 20 programs in the mix freebsd at any time (I guess they were accustomed to IBM 360s that freebsd couldn't walk and chew gum at the same time :-). Yes, I know UNIX was born as TSS in 1970. And today I occupy my FreeBSD box. It is not necessary to share it with my colleagues. Thanks to Moore's Law and so many FreeBSD guys. It is easy to prepare a dedicated machine for debugging purpose and run a test program only. Daemons are still running in background but they are almost asleep (load averages: 0.00) so will not be critical on wall-clock time profiling. Wall-clock time profiling will be useful to know what routines/system calls take time in complex code, especially I/O related routines. -- Akihiro KAYAMA ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: wall-clock time profiling
Akihiro KAYAMA wrote: Hi all. What is the right way to measure wall-clock time in profiling on FreeBSD? The time shell builtin command or /usr/bin/time -l _program_? The latter variant displays the rusage struct (ie, from man getrusage)? -- -Chuck ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: wall-clock time profiling
In article [EMAIL PROTECTED], Chuck Swiger [EMAIL PROTECTED] writes: cswiger Akihiro KAYAMA wrote: cswiger Hi all. cswiger cswiger What is the right way to measure wall-clock time in profiling on FreeBSD? cswiger cswiger The time shell builtin command or /usr/bin/time -l _program_? cswiger cswiger The latter variant displays the rusage struct (ie, from man getrusage)? Thanks for your response. Yes, we can know whether the program is I/O bound or CPU bound by time(1). But it is still unclear which part of the program is really waiting for I/O. So profiling is needed for tuning, although CPU time profiling gives me non-distinct result on I/O bound programs. It is reason why I want wall-clock time profiling. -- Akihiro KAYAMA ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: wall-clock time profiling
On Thu, May 31, 2007, Akihiro KAYAMA wrote: In article [EMAIL PROTECTED], Chuck Swiger [EMAIL PROTECTED] writes: cswiger Akihiro KAYAMA wrote: cswiger Hi all. cswiger cswiger What is the right way to measure wall-clock time in profiling on FreeBSD? cswiger cswiger The time shell builtin command or /usr/bin/time -l _program_? cswiger cswiger The latter variant displays the rusage struct (ie, from man getrusage)? Thanks for your response. Yes, we can know whether the program is I/O bound or CPU bound by time(1). But it is still unclear which part of the program is really waiting for I/O. So profiling is needed for tuning, although CPU time profiling gives me non-distinct result on I/O bound programs. It is reason why I want wall-clock time profiling. Wall clock time doesn't generally tell you anything reliably useful on a multi-tasking system as it's very dependent on other system activity. I had many fights back in the mid '70s with people in accounting who wanted to bill wall-clock time on Burroughs main frames which generally had 20 programs in the mix at any time (I guess they were accustomed to IBM 360s that couldn't walk and chew gum at the same time :-). If I had to measure wall-clock time for proceses, I would probably write a simple wrapper script to execute the command getting the system time before and after running the command I wanted to time: #!/usr/bin/env python import os, time tstart = time.time() os.system('some command') tend = time.time() et = tstart - tend print et Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way FAX:(206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 ``Lord, the money we do spend on Government and it's not one bit better than the government we got for one third the money twenty years ago.'' Will Rogers ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
wall-clock time profiling
Hi all. What is the right way to measure wall-clock time in profiling on FreeBSD? Standard profiling method in UNIX like 'gprof' measures CPU time, but it doesn't always offer a good indication for tuning if application is not CPU bound. For example, the below simple program spend most of the time for disk I/O, but gprof doesn't tell me that fsync(2) in output() is the hot-spot which should be removed at first. #include unistd.h #include sys/types.h #include sys/stat.h #include fcntl.h char calc() { int i; char c; for (i = 0; i 1; i++) { c = c * i; } return c; } void output(int fd, char c) { write(fd, c, 1); fsync(fd); /* XXX time consuming system call */ } int main() { int fd; int i; char c; fd = open(testfile, O_CREAT | O_WRONLY); for (i = 0; i 1; i++) { c = calc(i); output(fd, c); } return 0; } gprof's output: % cumulative self self total time seconds secondscalls ms/call ms/call name 84.2 0.56 0.561 0.06 0.06 calc [3] 13.6 0.65 0.091 0.01 0.01 _fsync [5] 1.4 0.66 0.011 0.00 0.00 write [6] 0.7 0.66 0.00 .mcount (12) 0.2 0.66 0.001 0.00 0.01 output [4] Measuring CPU time has been proper for traditional UNIX as TSS, but I think wall-clock time is also useful in these days. It is affected by system load, but it is easy to arrange some dedicated system for profiling purpose. Wall-clock time profiling itself could be implemented by simple kernel hack (i386/i386/trap.c:syscall() and kern/subr_trap.c:userret()), but if both CPU and wall-clock time profiling are available, I don't know how users should change the method. sysctl(8) may be inappropriate. Although I'm not familiar with another analysis tools, like DTrace for FreeBSD, is there something help for me? Thanks. -- Akihiro KAYAMA ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]