subr_lock.c (209059) | subr_lock.c (209247) |
---|---|
1/*- 2 * Copyright (c) 2006 John Baldwin <jhb@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 19 unchanged lines hidden (view full) --- 28 */ 29 30/* 31 * This module holds the global variables and functions used to maintain 32 * lock_object structures. 33 */ 34 35#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2006 John Baldwin <jhb@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 19 unchanged lines hidden (view full) --- 28 */ 29 30/* 31 * This module holds the global variables and functions used to maintain 32 * lock_object structures. 33 */ 34 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: head/sys/kern/subr_lock.c 209059 2010-06-11 18:46:34Z jhb $"); | 36__FBSDID("$FreeBSD: head/sys/kern/subr_lock.c 209247 2010-06-17 10:15:13Z avg $"); |
37 38#include "opt_ddb.h" 39#include "opt_mprof.h" 40 41#include <sys/param.h> 42#include <sys/systm.h> 43#include <sys/kernel.h> 44#include <sys/ktr.h> --- 548 unchanged lines hidden (view full) --- 593} 594 595void 596lock_profile_release_lock(struct lock_object *lo) 597{ 598 struct lock_profile_object *l; 599 struct lock_prof_type *type; 600 struct lock_prof *lp; | 37 38#include "opt_ddb.h" 39#include "opt_mprof.h" 40 41#include <sys/param.h> 42#include <sys/systm.h> 43#include <sys/kernel.h> 44#include <sys/ktr.h> --- 548 unchanged lines hidden (view full) --- 593} 594 595void 596lock_profile_release_lock(struct lock_object *lo) 597{ 598 struct lock_profile_object *l; 599 struct lock_prof_type *type; 600 struct lock_prof *lp; |
601 u_int64_t holdtime; | 601 u_int64_t curtime, holdtime; |
602 struct lpohead *head; 603 int spin; 604 605 if (lo->lo_flags & LO_NOPROFILE) 606 return; 607 spin = (LOCK_CLASS(lo)->lc_flags & LC_SPINLOCK) ? 1 : 0; 608 head = &curthread->td_lprof[spin]; 609 if (LIST_FIRST(head) == NULL) --- 11 unchanged lines hidden (view full) --- 621 break; 622 if (l == NULL) 623 goto out; 624 if (--l->lpo_ref > 0) 625 goto out; 626 lp = lock_profile_lookup(lo, spin, l->lpo_file, l->lpo_line); 627 if (lp == NULL) 628 goto release; | 602 struct lpohead *head; 603 int spin; 604 605 if (lo->lo_flags & LO_NOPROFILE) 606 return; 607 spin = (LOCK_CLASS(lo)->lc_flags & LC_SPINLOCK) ? 1 : 0; 608 head = &curthread->td_lprof[spin]; 609 if (LIST_FIRST(head) == NULL) --- 11 unchanged lines hidden (view full) --- 621 break; 622 if (l == NULL) 623 goto out; 624 if (--l->lpo_ref > 0) 625 goto out; 626 lp = lock_profile_lookup(lo, spin, l->lpo_file, l->lpo_line); 627 if (lp == NULL) 628 goto release; |
629 holdtime = nanoseconds() - l->lpo_acqtime; 630 if (holdtime < 0) | 629 curtime = nanoseconds(); 630 if (curtime < l->lpo_acqtime) |
631 goto release; | 631 goto release; |
632 holdtime = curtime - l->lpo_acqtime; 633 |
|
632 /* 633 * Record if the lock has been held longer now than ever 634 * before. 635 */ 636 if (holdtime > lp->cnt_max) 637 lp->cnt_max = holdtime; 638 if (l->lpo_waittime > lp->cnt_wait_max) 639 lp->cnt_wait_max = l->lpo_waittime; --- 28 unchanged lines hidden --- | 634 /* 635 * Record if the lock has been held longer now than ever 636 * before. 637 */ 638 if (holdtime > lp->cnt_max) 639 lp->cnt_max = holdtime; 640 if (l->lpo_waittime > lp->cnt_wait_max) 641 lp->cnt_wait_max = l->lpo_waittime; --- 28 unchanged lines hidden --- |