Date: Fri, 03 Oct 1997 00:00:22 -0700 (PDT) From: Simon Shapiro <Shimon@i-Connect.Net> To: freebsd-hackers@freebsd.org, freebsd-dlm@primer.i-connect.net Subject: Advice Seeked - Non-Invasive Metrics Techniques Message-ID: <XFMail.971003000022.Shimon@i-Connect.Net>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.971003000022.Shimon>
