From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id D9994BC69 for ; Fri, 9 Feb 2007 14:50:59 +0100 (CET) Received: from smtp.janestcapital.com (www.janestcapital.com [66.155.124.107]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l19DovpZ032342 for ; Fri, 9 Feb 2007 14:50:59 +0100 Received: from [192.168.250.117] [209.213.205.130] by janestcapital.com with ESMTP (SMTPD-9.10) id AC3F020C; Fri, 09 Feb 2007 08:50:55 -0500 Message-ID: <45CC7C40.7000103@janestcapital.com> Date: Fri, 09 Feb 2007 08:50:56 -0500 From: Brian Hurt User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: ls-ocaml-developer-2006@m-e-leypold.de Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Multiplication of matrix in C and OCaml References: <45CAF3E2.7020807@univ-paris12.fr> <45CAFF5A.2020607@inria.fr> <45CB3ED0.9040200@univ-paris12.fr> <20070209.115842.106265091.garrigue@math.nagoya-u.ac.jp> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 45CC7C41.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 matrices:01 printf:01 ocaml:01 gettimeofday:01 gettimeofday:01 printf:01 unix:01 unix:01 caml-list:01 output:02 let:03 let:03 brian:04 brian:04 >I'd feel better if the code is benchmarked in a way >that the result of the multiplication is output to a file and to >subtract the constant contribution of that to the run time that the >time is measured for various problem sizes (number of matrices). > For the C side, I recommend using clock() to time the runs. This also factors out the cost of creating the random matricies. Basically, you just do: #include ... { clock_t start, stop; ... start = clock(); /* stuff to time here */ stop = clock(); printf("The amount of time taken = %f seconds\n", ((double)(stop-start))/((double) CLOCKS_PER_SEC)); /* write result to file */ } In Ocaml, Unix.gettimeofday can be used similiarly: let start = Unix.gettimeofday() in (* stuff to time here *) let stop = Unix.gettimeofday() in Printf.printf "The amount of time taken = %f seconds\n" (stop -. start); (* write results to file *) Brian