/* * This code maintains a list of active profiling data structures. * * Copyright IBM Corp. 2009 * Author(s): Peter Oberparleiter * * Uses gcc-internal data definitions. * Based on the gcov-kernel patch by: * Hubertus Franke * Nigel Hinds * Rajan Ravindran * Peter Oberparleiter * Paul Larson */ #define pr_fmt(fmt) "gcov: " fmt #include #include #include #include #include "gcov.h" static int gcov_events_enabled; static DEFINE_MUTEX(gcov_lock); /* * __gcov_init is called by gcc-generated constructor code for each object * file compiled with -fprofile-arcs. */ void __gcov_init(struct gcov_info *info) { static unsigned int gcov_version; mutex_lock(&gcov_lock); if (gcov_version == 0) { gcov_version = gcov_info_version(info); /* * Printing gcc's version magic may prove useful for debugging * incompatibility reports. */ pr_info("version magic: 0x%x\n", gcov_version); } /* * Add new profiling data structure to list and inform event * listener. */ gcov_info_link(info); if (gcov_events_enabled) gcov_event(GCOV_ADD, info); mutex_unlock(&gcov_lock); } EXPORT_SYMBOL(__gcov_init); /* * These functions may be referenced by gcc-generated profiling code but serve * no function for kernel profiling. */ void __gcov_flush(void) { /* Unused. */ } EXPORT_SYMBOL(__gcov_flush); void __gcov_merge_add(gcov_type *counters, unsigned int n_counters) { /* Unused. */ } EXPORT_SYMBOL(__gcov_merge_add); void __gcov_merge_single(gcov_type *counters, unsigned int n_counters) { /* Unused. */ } EXPORT_SYMBOL(__gcov_merge_single); void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters) { /* Unused. */ } EXPORT_SYMBOL(__gcov_merge_delta); void __gcov_merge_ior(gcov_type *counters, unsigned int n_counters) { /* Unused. */ } EXPORT_SYMBOL(__gcov_merge_ior); void __gcov_merge_time_profile(gcov_type *counters, unsigned int n_counters) { /* Unused. */ } EXPORT_SYMBOL(__gcov_merge_time_profile); void __gcov_merge_icall_topn(gcov_type *counters, unsigned int n_counters) { /* Unused. */ } EXPORT_SYMBOL(__gcov_merge_icall_topn); /** * gcov_enable_events - enable event reporting through gcov_event() * * Turn on reporting of profiling data load/unload-events through the * gcov_event() callback. Also replay all previous events once. This function * is needed because some events are potentially generated too early for the * callback implementation to handle them initially. */ void gcov_enable_events(void) { struct gcov_info *info = NULL; mutex_lock(&gcov_lock); gcov_events_enabled = 1; /* Perform event callback for previously registered entries. */ while ((info = gcov_info_next(info))) { gcov_event(GCOV_ADD, info); cond_resched(); } mutex_unlock(&gcov_lock); } #ifdef CONFIG_MODULES /* Update list and generate events when modules are unloaded. */ static int gcov_module_notifier(struct notifier_block *nb, unsigned long event, void *data) { struct module *mod = data; struct gcov_info *info = NULL; struct gcov_info *prev = NULL; if (event != MODULE_STATE_GOING) return NOTIFY_OK; mutex_lock(&gcov_lock); /* Remove entries located in module from linked list. */ while ((info = gcov_info_next(info))) { if (within_module((unsigned long)info, mod)) { gcov_info_unlink(prev, info); if (gcov_events_enabled) gcov_event(GCOV_REMOVE, info); } else prev = info; } mutex_unlock(&gcov_lock); return NOTIFY_OK; } static struct notifier_block gcov_nb = { .notifier_call = gcov_module_notifier, }; static int __init gcov_init(void) { return register_module_notifier(&gcov_nb); } device_initcall(gcov_init); #endif /* CONFIG_MODULES */ e2755d3f3e100103967788b8b5a4bce'/>
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-12-25 14:01:28 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-25 14:01:28 -0800
commit10bbe7599e2755d3f3e100103967788b8b5a4bce (patch)
treef4d5bc444584dc211c5797be5aad5e861c9181b3 /include/trace/events/power.h
parent62906027091f1d02de44041524f0769f60bb9cf3 (diff)
parent6886fee4d7a3afaf905a8e0bec62dc8fdc39878d (diff)
Merge branch 'turbostat' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux
Pull turbostat updates from Len Brown. * 'turbostat' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux: tools/power turbostat: remove obsolete -M, -m, -C, -c options tools/power turbostat: Make extensible via the --add parameter tools/power turbostat: Denverton uses a 25 MHz crystal, not 19.2 MHz tools/power turbostat: line up headers when -M is used tools/power turbostat: fix SKX PKG_CSTATE_LIMIT decoding tools/power turbostat: Support Knights Mill (KNM) tools/power turbostat: Display HWP OOB status tools/power turbostat: fix Denverton BCLK tools/power turbostat: use intel-family.h model strings tools/power/turbostat: Add Denverton RAPL support tools/power/turbostat: Add Denverton support tools/power/turbostat: split core MSR support into status + limit tools/power turbostat: fix error case overflow read of slm_freq_table[] tools/power turbostat: Allocate correct amount of fd and irq entries tools/power turbostat: switch to tab delimited output tools/power turbostat: Gracefully handle ACPI S3 tools/power turbostat: tidy up output on Joule counter overflow
Diffstat (limited to 'include/trace/events/power.h')