kern_tc.c (f23b4c91c4fb94e1bb6aeb4e7747f4ccf7767b41) | kern_tc.c (8a129caed5f1b834a2d3f825478f5f0273f9cb9d) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 | 1/*- 2 * Copyright (c) 1982, 1986, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 |
39 * $Id: kern_clock.c,v 1.3 1994/08/02 07:41:54 davidg Exp $ | 39 * $Id: kern_clock.c,v 1.4 1994/08/18 22:34:58 wollman Exp $ |
40 */ 41 42#include <sys/param.h> 43#include <sys/systm.h> 44#include <sys/dkstat.h> 45#include <sys/callout.h> 46#include <sys/kernel.h> 47#include <sys/proc.h> 48#include <sys/resourcevar.h> | 40 */ 41 42#include <sys/param.h> 43#include <sys/systm.h> 44#include <sys/dkstat.h> 45#include <sys/callout.h> 46#include <sys/kernel.h> 47#include <sys/proc.h> 48#include <sys/resourcevar.h> |
49#include <vm/vm.h> |
|
49 50#include <machine/cpu.h> 51 52#ifdef GPROF 53#include <sys/gmon.h> 54#endif 55 56/* Does anybody else really care about these? */ --- 369 unchanged lines hidden (view full) --- 426 */ 427void 428statclock(frame) 429 register struct clockframe *frame; 430{ 431#ifdef GPROF 432 register struct gmonparam *g; 433#endif | 50 51#include <machine/cpu.h> 52 53#ifdef GPROF 54#include <sys/gmon.h> 55#endif 56 57/* Does anybody else really care about these? */ --- 369 unchanged lines hidden (view full) --- 427 */ 428void 429statclock(frame) 430 register struct clockframe *frame; 431{ 432#ifdef GPROF 433 register struct gmonparam *g; 434#endif |
434 register struct proc *p; | 435 register struct proc *p = curproc; |
435 register int i; 436 | 436 register int i; 437 |
438 if (p) { 439 struct pstats *pstats; 440 struct rusage *ru; 441 struct vmspace *vm; 442 443 /* bump the resource usage of integral space use */ 444 if ((pstats = p->p_stats) && (ru = &pstats->p_ru) && (vm = p->p_vmspace)) { 445 ru->ru_ixrss += vm->vm_tsize * PAGE_SIZE / 1024; 446 ru->ru_idrss += vm->vm_dsize * PAGE_SIZE / 1024; 447 ru->ru_isrss += vm->vm_ssize * PAGE_SIZE / 1024; 448 if ((vm->vm_pmap.pm_stats.resident_count * PAGE_SIZE / 1024) > 449 ru->ru_maxrss) { 450 ru->ru_maxrss = 451 vm->vm_pmap.pm_stats.resident_count * PAGE_SIZE / 1024; 452 } 453 } 454 } 455 |
|
437 if (CLKF_USERMODE(frame)) { | 456 if (CLKF_USERMODE(frame)) { |
438 p = curproc; | |
439 if (p->p_flag & P_PROFIL) 440 addupc_intr(p, CLKF_PC(frame), 1); 441 if (--pscnt > 0) 442 return; 443 /* 444 * Came from user mode; CPU was in user state. 445 * If this process is being profiled record the tick. 446 */ --- 25 unchanged lines hidden (view full) --- 472 * user process, or 473 * - spinning in the idle loop. 474 * Whichever it is, charge the time as appropriate. 475 * Note that we charge interrupts to the current process, 476 * regardless of whether they are ``for'' that process, 477 * so that we know how much of its real time was spent 478 * in ``non-process'' (i.e., interrupt) work. 479 */ | 457 if (p->p_flag & P_PROFIL) 458 addupc_intr(p, CLKF_PC(frame), 1); 459 if (--pscnt > 0) 460 return; 461 /* 462 * Came from user mode; CPU was in user state. 463 * If this process is being profiled record the tick. 464 */ --- 25 unchanged lines hidden (view full) --- 490 * user process, or 491 * - spinning in the idle loop. 492 * Whichever it is, charge the time as appropriate. 493 * Note that we charge interrupts to the current process, 494 * regardless of whether they are ``for'' that process, 495 * so that we know how much of its real time was spent 496 * in ``non-process'' (i.e., interrupt) work. 497 */ |
480 p = curproc; | |
481 if (CLKF_INTR(frame)) { 482 if (p != NULL) 483 p->p_iticks++; 484 cp_time[CP_INTR]++; 485 } else if (p != NULL) { 486 p->p_sticks++; 487 cp_time[CP_SYS]++; 488 } else --- 60 unchanged lines hidden --- | 498 if (CLKF_INTR(frame)) { 499 if (p != NULL) 500 p->p_iticks++; 501 cp_time[CP_INTR]++; 502 } else if (p != NULL) { 503 p->p_sticks++; 504 cp_time[CP_SYS]++; 505 } else --- 60 unchanged lines hidden --- |