From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA10119; Tue, 25 Nov 2003 22:54:42 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA09711 for ; Tue, 25 Nov 2003 22:54:39 +0100 (MET) Received: from mail4.bluewin.ch (mail4.bluewin.ch [195.186.4.74]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id hAPLsc117391; Tue, 25 Nov 2003 22:54:38 +0100 (MET) Received: from [10.0.1.2] (62.202.61.139) by mail4.bluewin.ch (Bluewin AG 7.0.024) id 3FBC8398000BB0C1; Tue, 25 Nov 2003 21:54:37 +0000 In-Reply-To: <20031125190553.B1064@pauillac.inria.fr> References: <81F621FD-1629-11D8-A1E1-000393DBC266@epfl.ch> <20031125190553.B1064@pauillac.inria.fr> Mime-Version: 1.0 (Apple Message framework v606) Content-Type: text/plain; charset=ISO-8859-1; format=flowed Message-Id: Content-Transfer-Encoding: quoted-printable Cc: Damien Doligez , caml-list@inria.fr From: =?ISO-8859-1?Q?Daniel_B=FCnzli?= Subject: Re: [Caml-list] Profiling a function execution Date: Tue, 25 Nov 2003 22:54:42 +0100 To: Xavier Leroy X-Mailer: Apple Mail (2.606) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 kernels:01 syscall:01 exploited:01 darwin:01 granularity:01 usefulness:01 stdio:01 stdlib:01 unistd:01 struct:01 printf:01 utime:01 clk:99 clk:99 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Le 25 nov. 03, =E0 19:05, Xavier Leroy a =E9crit : > I haven't looked at other Unix > kernels, but I suspect that the additional precision made possible by > the getrusage() syscall is simply not exploited. I have done tests using the C code appended to this email. Indeed with the Darwin Kernel 7.0.0 (MacOS X), you don't get extra=20 precision with the figures returned by getrusage(). I was mistaken by=20 the potential of the data structure described in the man page (there's=20= no info about the actual granularity there). You can remove my wish (id=3D1937) for getrusage bindings from your=20 database. > your question begs another > question: why would you need to do distinguish native code from > bytecode? I just wanted a quick way to distinguish, on output, my bytecode=20 profiles from native ones. This can of course be handled very easily=20 with a preprocessor, I was just wondering if I had missed a flag in the=20= style of Sys.interactive. > We're working hard on removing the last discrepancies > between the two compilers... One could argue that since there exists some discrepancies such a flag=20= should exist. However I doubt its usefulness in common practice (which=20= is why I didn't file a feature wish for that one). Furthermore, if it=20 doesn't exist, removing the last discrepancies becomes a must... Thanks for your answers, Daniel --- test.c --- #include #include #include #include #include #include #include #include #include #define NUM_OPS ULONG_MAX / 100 void idle (void) { unsigned long i; int op; for (i =3D 0; i < NUM_OPS; i++) op =3D 1+1; } void diff_times (void) { struct tms t1, t2; times(&t1); idle(); times(&t2); printf("times: %fs user %fs sys\n", (double)(t2.tms_utime-t1.tms_utime) / CLK_TCK, (double)(t2.tms_stime-t1.tms_stime) / CLK_TCK); } void diff_getrusage(void) { struct rusage t1, t2; getrusage(RUSAGE_SELF, &t1); idle(); getrusage(RUSAGE_SELF, &t2); printf("getrusage: %fs user %fs sys\n", (double)t2.ru_utime.tv_sec + (double)t2.ru_utime.tv_usec / 1e6 = - ((double)t1.ru_utime.tv_sec + (double)t1.ru_utime.tv_usec / = 1e6), (double)t2.ru_stime.tv_sec + (double)t2.ru_stime.tv_usec / 1e6 = - ((double)t1.ru_stime.tv_sec + (double)t1.ru_stime.tv_usec / = 1e6)); =09 } int main(int argc, char **argv) { diff_times(); diff_getrusage(); return 0; }= ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners