diff options
author | jkoshy <jkoshy@FreeBSD.org> | 2007-12-03 11:11:08 +0000 |
---|---|---|
committer | jkoshy <jkoshy@FreeBSD.org> | 2007-12-03 11:11:08 +0000 |
commit | 8304a663db3ad44c1f9590aedd446c2f1360dd54 (patch) | |
tree | 0a4ddd64acca61be6a7ad712882f91b392d9d4c2 /sys | |
parent | ca4d74c30f1aa58b63eaa10ccf9799785eb6ec5c (diff) | |
download | FreeBSD-src-8304a663db3ad44c1f9590aedd446c2f1360dd54.zip FreeBSD-src-8304a663db3ad44c1f9590aedd446c2f1360dd54.tar.gz |
Add userland definitions for parsing callchain records.
Sponsored by: FreeBSD Foundation and Google Inc.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/sys/pmc.h | 12 | ||||
-rw-r--r-- | sys/sys/pmclog.h | 27 |
2 files changed, 34 insertions, 5 deletions
diff --git a/sys/sys/pmc.h b/sys/sys/pmc.h index c0329af..1656a92 100644 --- a/sys/sys/pmc.h +++ b/sys/sys/pmc.h @@ -1,7 +1,11 @@ /*- - * Copyright (c) 2003-2006, Joseph Koshy + * Copyright (c) 2003-2007, Joseph Koshy + * Copyright (c) 2007 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by A. Joseph Koshy under + * sponsorship from the FreeBSD Foundation and Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -263,7 +267,6 @@ enum pmc_event { * "PMC_OPS" -- these are the commands recognized by the kernel * module, and are used when performing a system call from userland. */ - #define __PMC_OPS() \ __PMC_OP(CONFIGURELOG, "Set log file") \ __PMC_OP(FLUSHLOG, "Flush log file") \ @@ -301,12 +304,17 @@ enum pmc_ops { #define PMC_F_NEWVALUE 0x00000010 /*OP RW write new value */ #define PMC_F_OLDVALUE 0x00000020 /*OP RW get old value */ #define PMC_F_KGMON 0x00000040 /*OP ALLOCATE kgmon(8) profiling */ +/* V2 API */ +#define PMC_F_CALLCHAIN 0x00000080 /*OP ALLOCATE capture callchains */ /* internal flags */ #define PMC_F_ATTACHED_TO_OWNER 0x00010000 /*attached to owner*/ #define PMC_F_NEEDS_LOGFILE 0x00020000 /*needs log file */ #define PMC_F_ATTACH_DONE 0x00040000 /*attached at least once */ +#define PMC_CALLCHAIN_DEPTH_MAX 32 +#define PMC_CC_F_USERSPACE 0x01 /*userspace callchain*/ + /* * Cookies used to denote allocated PMCs, and the values of PMCs. */ diff --git a/sys/sys/pmclog.h b/sys/sys/pmclog.h index 8d1b25c..80ae567 100644 --- a/sys/sys/pmclog.h +++ b/sys/sys/pmclog.h @@ -1,7 +1,11 @@ /*- - * Copyright (c) 2005-2006, Joseph Koshy + * Copyright (c) 2005-2007, Joseph Koshy + * Copyright (c) 2007 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by A. Joseph Koshy under + * sponsorship from the FreeBSD Foundation and Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -51,10 +55,12 @@ enum pmclog_type { * V2 ABI * * The MAP_{IN,OUT} event types obsolete the MAPPING_CHANGE - * event type of the older (V1) ABI. + * event type. The CALLCHAIN event type obsoletes the + * PCSAMPLE event type. */ PMCLOG_TYPE_MAP_IN, - PMCLOG_TYPE_MAP_OUT + PMCLOG_TYPE_MAP_OUT, + PMCLOG_TYPE_CALLCHAIN }; /* @@ -90,6 +96,20 @@ enum pmclog_type { * of 4 byte quantities. */ +struct pmclog_callchain { + PMCLOG_ENTRY_HEADER + uint32_t pl_pid; + uint32_t pl_pmcid; + uint32_t pl_cpuflags; + /* 8 byte aligned */ + uintptr_t pl_pc[PMC_CALLCHAIN_DEPTH_MAX]; +} __packed; + +#define PMC_CALLCHAIN_CPUFLAGS_TO_CPU(CF) (((CF) >> 16) & 0xFFFF) +#define PMC_CALLCHAIN_CPUFLAGS_TO_USERMODE(CF) ((CF) & PMC_CC_F_USERSPACE) +#define PMC_CALLCHAIN_TO_CPUFLAGS(CPU,FLAGS) \ + (((CPU) << 16) | ((FLAGS) & 0xFFFF)) + struct pmclog_closelog { PMCLOG_ENTRY_HEADER }; @@ -185,6 +205,7 @@ struct pmclog_userdata { } __packed; union pmclog_entry { /* only used to size scratch areas */ + struct pmclog_callchain pl_cc; struct pmclog_closelog pl_cl; struct pmclog_dropnotify pl_dn; struct pmclog_initialize pl_i; |