hwpmc_logging.c (156466) | hwpmc_logging.c (157144) |
---|---|
1/*- 2 * Copyright (c) 2005 Joseph Koshy 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 --- 16 unchanged lines hidden (view full) --- 25 * 26 */ 27 28/* 29 * Logging code for hwpmc(4) 30 */ 31 32#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2005 Joseph Koshy 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 --- 16 unchanged lines hidden (view full) --- 25 * 26 */ 27 28/* 29 * Logging code for hwpmc(4) 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/dev/hwpmc/hwpmc_logging.c 156466 2006-03-09 02:08:12Z jkoshy $"); | 33__FBSDID("$FreeBSD: head/sys/dev/hwpmc/hwpmc_logging.c 157144 2006-03-26 12:20:54Z jkoshy $"); |
34 35#include <sys/param.h> 36#include <sys/file.h> 37#include <sys/kernel.h> 38#include <sys/kthread.h> 39#include <sys/lock.h> 40#include <sys/module.h> 41#include <sys/mutex.h> --- 90 unchanged lines hidden (view full) --- 132 133 134/* 135 * Assertions about the log file format. 136 */ 137 138CTASSERT(sizeof(struct pmclog_closelog) == 3*4); 139CTASSERT(sizeof(struct pmclog_dropnotify) == 3*4); | 34 35#include <sys/param.h> 36#include <sys/file.h> 37#include <sys/kernel.h> 38#include <sys/kthread.h> 39#include <sys/lock.h> 40#include <sys/module.h> 41#include <sys/mutex.h> --- 90 unchanged lines hidden (view full) --- 132 133 134/* 135 * Assertions about the log file format. 136 */ 137 138CTASSERT(sizeof(struct pmclog_closelog) == 3*4); 139CTASSERT(sizeof(struct pmclog_dropnotify) == 3*4); |
140CTASSERT(sizeof(struct pmclog_mappingchange) == PATH_MAX + 141 5*4 + 2*sizeof(uintfptr_t)); 142CTASSERT(offsetof(struct pmclog_mappingchange,pl_pathname) == 143 5*4 + 2*sizeof(uintfptr_t)); | 140CTASSERT(sizeof(struct pmclog_map_in) == PATH_MAX + 141 4*4 + sizeof(uintfptr_t)); 142CTASSERT(offsetof(struct pmclog_map_in,pl_pathname) == 143 4*4 + sizeof(uintfptr_t)); 144CTASSERT(sizeof(struct pmclog_map_out) == 4*4 + 2*sizeof(uintfptr_t)); |
144CTASSERT(sizeof(struct pmclog_pcsample) == 6*4 + sizeof(uintfptr_t)); 145CTASSERT(sizeof(struct pmclog_pmcallocate) == 6*4); 146CTASSERT(sizeof(struct pmclog_pmcattach) == 5*4 + PATH_MAX); 147CTASSERT(offsetof(struct pmclog_pmcattach,pl_pathname) == 5*4); 148CTASSERT(sizeof(struct pmclog_pmcdetach) == 5*4); 149CTASSERT(sizeof(struct pmclog_proccsw) == 5*4 + 8); 150CTASSERT(sizeof(struct pmclog_procexec) == 5*4 + PATH_MAX + 151 sizeof(uintfptr_t)); --- 571 unchanged lines hidden (view full) --- 723void 724pmclog_process_dropnotify(struct pmc_owner *po) 725{ 726 PMCLOG_RESERVE(po,DROPNOTIFY,sizeof(struct pmclog_dropnotify)); 727 PMCLOG_DESPATCH(po); 728} 729 730void | 145CTASSERT(sizeof(struct pmclog_pcsample) == 6*4 + sizeof(uintfptr_t)); 146CTASSERT(sizeof(struct pmclog_pmcallocate) == 6*4); 147CTASSERT(sizeof(struct pmclog_pmcattach) == 5*4 + PATH_MAX); 148CTASSERT(offsetof(struct pmclog_pmcattach,pl_pathname) == 5*4); 149CTASSERT(sizeof(struct pmclog_pmcdetach) == 5*4); 150CTASSERT(sizeof(struct pmclog_proccsw) == 5*4 + 8); 151CTASSERT(sizeof(struct pmclog_procexec) == 5*4 + PATH_MAX + 152 sizeof(uintfptr_t)); --- 571 unchanged lines hidden (view full) --- 724void 725pmclog_process_dropnotify(struct pmc_owner *po) 726{ 727 PMCLOG_RESERVE(po,DROPNOTIFY,sizeof(struct pmclog_dropnotify)); 728 PMCLOG_DESPATCH(po); 729} 730 731void |
731pmclog_process_mappingchange(struct pmc_owner *po, pid_t pid, int type, 732 uintfptr_t start, uintfptr_t end, char *path) | 732pmclog_process_map_in(struct pmc_owner *po, pid_t pid, uintfptr_t start, 733 const char *path) |
733{ 734 int pathlen, recordlen; 735 | 734{ 735 int pathlen, recordlen; 736 |
737 KASSERT(path != NULL, ("[pmclog,%d] map-in, null path", __LINE__)); 738 |
|
736 pathlen = strlen(path) + 1; /* #bytes for path name */ | 739 pathlen = strlen(path) + 1; /* #bytes for path name */ |
737 recordlen = offsetof(struct pmclog_mappingchange, pl_pathname) + | 740 recordlen = offsetof(struct pmclog_map_in, pl_pathname) + |
738 pathlen; 739 | 741 pathlen; 742 |
740 PMCLOG_RESERVE(po,MAPPINGCHANGE,recordlen); 741 PMCLOG_EMIT32(type); 742 PMCLOG_EMITADDR(start); 743 PMCLOG_EMITADDR(end); | 743 PMCLOG_RESERVE(po, MAP_IN, recordlen); |
744 PMCLOG_EMIT32(pid); | 744 PMCLOG_EMIT32(pid); |
745 PMCLOG_EMITADDR(start); |
|
745 PMCLOG_EMITSTRING(path,pathlen); 746 PMCLOG_DESPATCH(po); 747} 748 | 746 PMCLOG_EMITSTRING(path,pathlen); 747 PMCLOG_DESPATCH(po); 748} 749 |
750void 751pmclog_process_map_out(struct pmc_owner *po, pid_t pid, uintfptr_t start, 752 uintfptr_t end) 753{ 754 KASSERT(start <= end, ("[pmclog,%d] start > end", __LINE__)); |
|
749 | 755 |
756 PMCLOG_RESERVE(po, MAP_OUT, sizeof(struct pmclog_map_out)); 757 PMCLOG_EMIT32(pid); 758 PMCLOG_EMITADDR(start); 759 PMCLOG_EMITADDR(end); 760 PMCLOG_DESPATCH(po); 761} 762 |
|
750void 751pmclog_process_pcsample(struct pmc *pm, struct pmc_sample *ps) 752{ 753 struct pmc_owner *po; 754 755 PMCDBG(LOG,SAM,1,"pm=%p pid=%d pc=%p", pm, ps->ps_pid, 756 (void *) ps->ps_pc); 757 --- 228 unchanged lines hidden --- | 763void 764pmclog_process_pcsample(struct pmc *pm, struct pmc_sample *ps) 765{ 766 struct pmc_owner *po; 767 768 PMCDBG(LOG,SAM,1,"pm=%p pid=%d pc=%p", pm, ps->ps_pid, 769 (void *) ps->ps_pc); 770 --- 228 unchanged lines hidden --- |