Add userland definitions for parsing callchain records.
Sponsored by: FreeBSD Foundation and Google Inc.
This commit is contained in:
parent
0b84422642
commit
c438255074
@ -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.
|
||||
*/
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user