Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: How to continue monitoring file access (Was: Problem solved, but WHY??? (Long))
On Sat, 11 Nov 2000, yong huang wrote:
> I know the command "fuser somefile" reports what processes are accessing
> somefile. Is there a way to continue monitoring this so it won't exit at the
> initial detection? I'd like to see the output like "tail -f somelogfile". I
> don't think wrapping this in a shell infinite loop is an option because (1) if
> you don't use sleep in the loop, it hogs CPU; (2) if you do, there's too much
> gap between two fuser calls.
>
> Yong Huang
> yong321_at_yahoo.com
>
1 second between calls to fuser via 'sleep 1' seems reasonable.
If you need more granularity, and your system supports high resolution timers, here's an example of one that will time in nano-seconds.
#include <sys/time.h>
#include <stdio.h>
void main ( int argc, char *argv[] ) {
hrtime_t start, end; int i; i = argv[1] == NULL ? 200000000 : atoi(argv[1]); printf("Nanoseconds: %i nsec\n", i); start = gethrtime(); printf("Start: %lld nsec\n", start); for (;;) { end = gethrtime(); if ( ( end - start ) >= i ) { break; } } printf("End: %lld nsec\n", end);
}
Jared Still
Certified Oracle DBA and Part Time Perl Evangelist ;-)
Regence BlueCross BlueShield of Oregon
jkstill_at_bcbso.com - Work - preferred address
Received on Tue Nov 14 2000 - 09:05:16 CST