Release 4.15 kernel/gcov/base.c
// SPDX-License-Identifier: GPL-2.0
/*
* This code maintains a list of active profiling data structures.
*
* Copyright IBM Corp. 2009
* Author(s): Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
*
* Uses gcc-internal data definitions.
* Based on the gcov-kernel patch by:
* Hubertus Franke <frankeh@us.ibm.com>
* Nigel Hinds <nhinds@us.ibm.com>
* Rajan Ravindran <rajancr@us.ibm.com>
* Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
* Paul Larson
*/
#define pr_fmt(fmt) "gcov: " fmt
#include <linux/init.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/sched.h>
#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);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Peter Oberparleiter | 61 | 91.04% | 1 | 50.00% |
Frantisek Hrbata | 6 | 8.96% | 1 | 50.00% |
Total | 67 | 100.00% | 2 | 100.00% |
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. */
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Peter Oberparleiter | 8 | 100.00% | 1 | 100.00% |
Total | 8 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL(__gcov_flush);
void __gcov_merge_add(gcov_type *counters, unsigned int n_counters)
{
/* Unused. */
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Peter Oberparleiter | 14 | 100.00% | 1 | 100.00% |
Total | 14 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL(__gcov_merge_add);
void __gcov_merge_single(gcov_type *counters, unsigned int n_counters)
{
/* Unused. */
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Peter Oberparleiter | 14 | 100.00% | 1 | 100.00% |
Total | 14 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL(__gcov_merge_single);
void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters)
{
/* Unused. */
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Peter Oberparleiter | 14 | 100.00% | 1 | 100.00% |
Total | 14 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL(__gcov_merge_delta);
void __gcov_merge_ior(gcov_type *counters, unsigned int n_counters)
{
/* Unused. */
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Frantisek Hrbata | 14 | 100.00% | 1 | 100.00% |
Total | 14 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL(__gcov_merge_ior);
void __gcov_merge_time_profile(gcov_type *counters, unsigned int n_counters)
{
/* Unused. */
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Yuan Pengfei | 14 | 100.00% | 1 | 100.00% |
Total | 14 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL(__gcov_merge_time_profile);
void __gcov_merge_icall_topn(gcov_type *counters, unsigned int n_counters)
{
/* Unused. */
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Lorenzo Stoakes | 14 | 100.00% | 1 | 100.00% |
Total | 14 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL(__gcov_merge_icall_topn);
void __gcov_exit(void)
{
/* Unused. */
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Martin Liška | 8 | 100.00% | 1 | 100.00% |
Total | 8 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL(__gcov_exit);
/**
* 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);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Peter Oberparleiter | 39 | 72.22% | 1 | 33.33% |
Frantisek Hrbata | 10 | 18.52% | 1 | 33.33% |
Andrey Ryabinin | 5 | 9.26% | 1 | 33.33% |
Total | 54 | 100.00% | 3 | 100.00% |
#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;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Peter Oberparleiter | 95 | 81.90% | 1 | 33.33% |
Frantisek Hrbata | 16 | 13.79% | 1 | 33.33% |
Rusty Russell | 5 | 4.31% | 1 | 33.33% |
Total | 116 | 100.00% | 3 | 100.00% |
static struct notifier_block gcov_nb = {
.notifier_call = gcov_module_notifier,
};
static int __init gcov_init(void)
{
return register_module_notifier(&gcov_nb);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Peter Oberparleiter | 16 | 100.00% | 1 | 100.00% |
Total | 16 | 100.00% | 1 | 100.00% |
device_initcall(gcov_init);
#endif /* CONFIG_MODULES */
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Peter Oberparleiter | 343 | 74.73% | 1 | 11.11% |
Frantisek Hrbata | 51 | 11.11% | 2 | 22.22% |
Yuan Pengfei | 19 | 4.14% | 1 | 11.11% |
Lorenzo Stoakes | 19 | 4.14% | 1 | 11.11% |
Martin Liška | 13 | 2.83% | 1 | 11.11% |
Andrey Ryabinin | 8 | 1.74% | 1 | 11.11% |
Rusty Russell | 5 | 1.09% | 1 | 11.11% |
Greg Kroah-Hartman | 1 | 0.22% | 1 | 11.11% |
Total | 459 | 100.00% | 9 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.