From owner-freebsd-questions Fri Oct 3 00:00:06 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id AAA25025 for questions-outgoing; Fri, 3 Oct 1997 00:00:06 -0700 (PDT) Received: from primer.i-connect.net (primer.i-Connect.Net [206.190.143.13]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id XAA24977 for ; Thu, 2 Oct 1997 23:59:59 -0700 (PDT) Received: (qmail 897 invoked by uid 1008); 3 Oct 1997 07:04:34 -0000 Mailing-List: contact freebsd-dlm-help@primer.i-connect.net; run by ezmlm Delivered-To: mailing list freebsd-dlm@primer.i-connect.net Received: (qmail 891 invoked from network); 3 Oct 1997 07:04:33 -0000 Received: from sendero-ppp.i-connect.net (206.190.143.100) by primer.i-connect.net with SMTP; 3 Oct 1997 07:04:33 -0000 Received: (qmail 18461 invoked by uid 1000); 3 Oct 1997 07:00:22 -0000 Message-ID: X-Mailer: XFMail 1.2-alpha-092597 [p0] on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Date: Fri, 03 Oct 1997 00:00:22 -0700 (PDT) Organization: Atlas Telecom From: Simon Shapiro To: freebsd-hackers@freebsd.org, freebsd-dlm@primer.i-connect.net Subject: Advice Seeked - Non-Invasive Metrics Techniques Sender: owner-freebsd-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hi Y'all, I hope the subject line is accurate. I need to carefully tune and analyze timing and perfromance statistics. Mainly to identify why some rotines in the DLM take so much time. I am looking for ideas on how to measure the behavior of code, take time measurements, count events, etc. without consuming so much time. For example, when measuring time, I have the following strategy: In the dlm_lock_t structure, I have typedef struct dlm_lock } ... struct timeval start_time, stop_time; } dlm_lock_t Then, I have the function: static INLINE void dlm_debug_times(dlm_lock_t *lock, int line) { microtime(&lock->stop_time); printf("So far (%d) %d\n", line, time_delta(lock->start_time, lock->stop_time)); } ... Then, when I want to time sone code I do static int some_function(dlm_lock_t *lock, ...) { ... microtime(&lock->start_time); ... /* Before a certain block of code */ dlm_debug_times(lock, __LINE__); ... /* Some code to be timed */ ... dlm_debug_times(lock, __LINE__); ... } Is there a better way to do that? In this context, better means a way to impact the performance of the system to a lesser degree. I have a sneaking suspicion that the above mechnism takes a lot of time, thus upsetting the code being timed. Any suggestion will be appreciated. Thanx! --- Sincerely Yours, Simon Shapiro Atlas Telecom Senior Architect 14355 SW Allen Blvd., Suite 130 Beaverton OR 97005 Shimon@i-Connect.Net Voice: 503.799.2313