X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/3903760236c30e3b5ace7a4eefac3a269d68957c..0a7de7458d150b5d4dffc935ba399be265ef0a1a:/osfmk/kperf/action.h diff --git a/osfmk/kperf/action.h b/osfmk/kperf/action.h index 1233da6d0..420720b86 100644 --- a/osfmk/kperf/action.h +++ b/osfmk/kperf/action.h @@ -30,6 +30,8 @@ #define KPERF_ACTION_H #include +#include +#include /* fwd decl */ struct kperf_sample; @@ -47,10 +49,19 @@ struct kperf_context; #define SAMPLER_TH_SCHEDULING (1U << 8) #define SAMPLER_TH_DISPATCH (1U << 9) #define SAMPLER_TK_SNAPSHOT (1U << 10) +#define SAMPLER_SYS_MEM (1U << 11) +#define SAMPLER_TH_INSCYC (1U << 12) +#define SAMPLER_TK_INFO (1U << 13) + +#define SAMPLER_TASK_MASK (SAMPLER_MEMINFO | SAMPLER_TK_SNAPSHOT | \ + SAMPLER_TK_INFO) +#define SAMPLER_THREAD_MASK (SAMPLER_TH_INFO | SAMPLER_TH_SNAPSHOT | \ + SAMPLER_KSTACK | SAMPLER_USTACK | SAMPLER_PMC_THREAD | \ + SAMPLER_TH_SCHEDULING | SAMPLER_TH_DISPATCH | SAMPLER_TH_INSCYC) /* flags for sample calls */ -/* pend certain samplers until AST boundary, instead of sampling them */ +/* pend samplers requiring copyin until AST boundary */ #define SAMPLE_FLAG_PEND_USER (1U << 0) /* sample idle threads */ #define SAMPLE_FLAG_IDLE_THREADS (1U << 1) @@ -60,12 +71,25 @@ struct kperf_context; #define SAMPLE_FLAG_CONTINUATION (1U << 3) /* sample is occurring outside of interrupt context */ #define SAMPLE_FLAG_NON_INTERRUPT (1U << 4) +/* sample should include system samplers */ +#define SAMPLE_FLAG_SYSTEM (1U << 5) +/* sample should not include non-system samplers */ +#define SAMPLE_FLAG_ONLY_SYSTEM (1U << 6) +/* sample should only include task samplers */ +#define SAMPLE_FLAG_TASK_ONLY (1U << 7) +/* sample should only include thread samplers */ +#define SAMPLE_FLAG_THREAD_ONLY (1U << 8) /* Take a sample into "sbuf" using current thread "cur_thread" */ kern_return_t kperf_sample(struct kperf_sample *sbuf, - struct kperf_context *ctx, - unsigned actionid, - unsigned sample_flags); + struct kperf_context *ctx, + unsigned actionid, + unsigned sample_flags); + +/* Whether the action provided samples non-system values. */ +bool kperf_action_has_non_system(unsigned actionid); +bool kperf_action_has_thread(unsigned int actionid); +bool kperf_action_has_task(unsigned int actionid); /* return codes from taking a sample * either keep trigger, or something went wrong (or we're shutting down) @@ -95,4 +119,11 @@ int kperf_action_get_kcallstack_depth(unsigned int actionid, uint32_t * depth_ou int kperf_action_set_filter(unsigned int actionid, int pid); int kperf_action_get_filter(unsigned int actionid, int *pid_out); +void kperf_kdebug_handler(uint32_t debugid, uintptr_t *starting_fp); + +/* whether to output tracepoints on context-switch */ +extern int kperf_kdebug_cswitch; +int kperf_kdbg_cswitch_get(void); +int kperf_kdbg_cswitch_set(int newval); + #endif /* !defined(KPERF_ACTION_H) */