lockstat: track lockstat just like sdt probes
In particular flip the frequently tested var to bool.
This commit is contained in:
parent
5d2c81d91b
commit
4c5209cb21
@ -77,6 +77,7 @@ static void sdt_kld_unload_try(void *, struct linker_file *, int *);
|
||||
static MALLOC_DEFINE(M_SDT, "SDT", "DTrace SDT providers");
|
||||
|
||||
static int sdt_probes_enabled_count;
|
||||
static int lockstat_enabled_count;
|
||||
|
||||
static dtrace_pattr_t sdt_attr = {
|
||||
{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
|
||||
@ -208,8 +209,11 @@ sdt_enable(void *arg __unused, dtrace_id_t id, void *parg)
|
||||
|
||||
probe->id = id;
|
||||
probe->sdtp_lf->nenabled++;
|
||||
if (strcmp(probe->prov->name, "lockstat") == 0)
|
||||
lockstat_enabled++;
|
||||
if (strcmp(probe->prov->name, "lockstat") == 0) {
|
||||
lockstat_enabled_count++;
|
||||
if (lockstat_enabled_count == 1)
|
||||
lockstat_enabled = true;
|
||||
}
|
||||
sdt_probes_enabled_count++;
|
||||
if (sdt_probes_enabled_count == 1)
|
||||
sdt_probes_enabled = true;
|
||||
@ -225,8 +229,11 @@ sdt_disable(void *arg __unused, dtrace_id_t id, void *parg)
|
||||
sdt_probes_enabled_count--;
|
||||
if (sdt_probes_enabled_count == 0)
|
||||
sdt_probes_enabled = false;
|
||||
if (strcmp(probe->prov->name, "lockstat") == 0)
|
||||
lockstat_enabled--;
|
||||
if (strcmp(probe->prov->name, "lockstat") == 0) {
|
||||
lockstat_enabled_count--;
|
||||
if (lockstat_enabled_count == 0)
|
||||
lockstat_enabled = false;
|
||||
}
|
||||
probe->id = 0;
|
||||
probe->sdtp_lf->nenabled--;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ SDT_PROBE_DEFINE1(lockstat, , , sx__downgrade, "struct sx *");
|
||||
|
||||
SDT_PROBE_DEFINE2(lockstat, , , thread__spin, "struct mtx *", "uint64_t");
|
||||
|
||||
volatile int __read_frequently lockstat_enabled;
|
||||
volatile bool __read_frequently lockstat_enabled;
|
||||
|
||||
uint64_t
|
||||
lockstat_nsecs(struct lock_object *lo)
|
||||
|
@ -70,7 +70,7 @@ SDT_PROBE_DECLARE(lockstat, , , thread__spin);
|
||||
#define LOCKSTAT_WRITER 0
|
||||
#define LOCKSTAT_READER 1
|
||||
|
||||
extern volatile int lockstat_enabled;
|
||||
extern volatile bool lockstat_enabled;
|
||||
|
||||
#ifdef KDTRACE_HOOKS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user