skip call to _lock_profile_obtain_lock_success entirely if acquisition time is non-zero

(i.e. recursing or adding sharers)
This commit is contained in:
Kip Macy 2007-04-03 18:36:27 +00:00
parent 832a21869c
commit 8289600ce7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=168315
2 changed files with 15 additions and 16 deletions

View File

@ -254,21 +254,18 @@ void _lock_profile_obtain_lock_success(struct lock_object *lo, int contested, ui
{
struct lock_profile_object *l = &lo->lo_profile_obj;
/* don't reset the timer when/if recursing */
if (l->lpo_acqtime == 0) {
lo->lo_profile_obj.lpo_contest_holding = 0;
if (contested)
lo->lo_profile_obj.lpo_contest_locking++;
lo->lo_profile_obj.lpo_contest_holding = 0;
l->lpo_filename = file;
l->lpo_lineno = line;
l->lpo_acqtime = nanoseconds();
if (waittime && (l->lpo_acqtime > waittime))
l->lpo_waittime = l->lpo_acqtime - waittime;
else
l->lpo_waittime = 0;
}
if (contested)
lo->lo_profile_obj.lpo_contest_locking++;
l->lpo_filename = file;
l->lpo_lineno = line;
l->lpo_acqtime = nanoseconds();
if (waittime && (l->lpo_acqtime > waittime))
l->lpo_waittime = l->lpo_acqtime - waittime;
else
l->lpo_waittime = 0;
}
void _lock_profile_release_lock(struct lock_object *lo)

View File

@ -129,12 +129,14 @@ static inline void lock_profile_obtain_lock_failed(struct lock_object *lo, int *
static inline void lock_profile_obtain_lock_success(struct lock_object *lo, int contested, uint64_t waittime, const char *file, int line)
{
if (lock_prof_enable) {
/* don't reset the timer when/if recursing */
if (lock_prof_enable && lo->lo_profile_obj.lpo_acqtime == 0) {
#ifdef LOCK_PROFILING_FAST
if (contested == 0)
return;
#endif
_lock_profile_obtain_lock_success(lo, contested, waittime, file, line);
_lock_profile_obtain_lock_success(lo, contested, waittime, file, line);
}
}
static inline void lock_profile_release_lock(struct lock_object *lo)