mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-12-12 03:13:29 +08:00
instrument functions: Minimize stat() calls
This change decreases the execution time when the file indicating that instrumentation is "off" exists. [skip ci]
This commit is contained in:
parent
6008cb83b7
commit
e5bd2dcf49
@ -86,12 +86,19 @@ static void print_debug(void *this_fn, void *call_site, action_type action)
|
||||
static long symcount;
|
||||
static asection *text;
|
||||
static bfd_vma vma;
|
||||
static int instrument_off;
|
||||
static int print_only_global;
|
||||
symbol_info syminfo;
|
||||
struct stat statbuf;
|
||||
int i;
|
||||
|
||||
if (!stat(ND_FILE_FLAG_OFF, &statbuf))
|
||||
if (!instrument_off) {
|
||||
/* one-time test */
|
||||
if (!stat(ND_FILE_FLAG_OFF, &statbuf)) {
|
||||
instrument_off = 1;
|
||||
return;
|
||||
}
|
||||
} else
|
||||
return;
|
||||
|
||||
/* If no errors, this block should be executed one time */
|
||||
|
Loading…
Reference in New Issue
Block a user