Release 4.15 kernel/trace/trace_sched_switch.c
// SPDX-License-Identifier: GPL-2.0
/*
* trace context switch
*
* Copyright (C) 2007 Steven Rostedt <srostedt@redhat.com>
*
*/
#include <linux/module.h>
#include <linux/kallsyms.h>
#include <linux/uaccess.h>
#include <linux/ftrace.h>
#include <trace/events/sched.h>
#include "trace.h"
#define RECORD_CMDLINE 1
#define RECORD_TGID 2
static int sched_cmdline_ref;
static int sched_tgid_ref;
static DEFINE_MUTEX(sched_register_mutex);
static void
probe_sched_switch(void *ignore, bool preempt,
struct task_struct *prev, struct task_struct *next)
{
int flags;
flags = (RECORD_TGID * !!sched_tgid_ref) +
(RECORD_CMDLINE * !!sched_cmdline_ref);
if (!flags)
return;
tracing_record_taskinfo_sched_switch(prev, next, flags);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Joel Fernandes | 26 | 44.07% | 1 | 16.67% |
Steven Rostedt | 23 | 38.98% | 3 | 50.00% |
Mathieu Desnoyers | 7 | 11.86% | 1 | 16.67% |
Peter Zijlstra | 3 | 5.08% | 1 | 16.67% |
Total | 59 | 100.00% | 6 | 100.00% |
static void
probe_sched_wakeup(void *ignore, struct task_struct *wakee)
{
int flags;
flags = (RECORD_TGID * !!sched_tgid_ref) +
(RECORD_CMDLINE * !!sched_cmdline_ref);
if (!flags)
return;
tracing_record_taskinfo(current, flags);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Joel Fernandes | 25 | 51.02% | 1 | 14.29% |
Ingo Molnar | 14 | 28.57% | 2 | 28.57% |
Mathieu Desnoyers | 5 | 10.20% | 2 | 28.57% |
Steven Rostedt | 4 | 8.16% | 1 | 14.29% |
Zhao Lei | 1 | 2.04% | 1 | 14.29% |
Total | 49 | 100.00% | 7 | 100.00% |
static int tracing_sched_register(void)
{
int ret;
ret = register_trace_sched_wakeup(probe_sched_wakeup, NULL);
if (ret) {
pr_info("wakeup trace: Couldn't activate tracepoint"
" probe to kernel_sched_wakeup\n");
return ret;
}
ret = register_trace_sched_wakeup_new(probe_sched_wakeup, NULL);
if (ret) {
pr_info("wakeup trace: Couldn't activate tracepoint"
" probe to kernel_sched_wakeup_new\n");
goto fail_deprobe;
}
ret = register_trace_sched_switch(probe_sched_switch, NULL);
if (ret) {
pr_info("sched trace: Couldn't activate tracepoint"
" probe to kernel_sched_switch\n");
goto fail_deprobe_wake_new;
}
return ret;
fail_deprobe_wake_new:
unregister_trace_sched_wakeup_new(probe_sched_wakeup, NULL);
fail_deprobe:
unregister_trace_sched_wakeup(probe_sched_wakeup, NULL);
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Mathieu Desnoyers | 96 | 89.72% | 2 | 50.00% |
Steven Rostedt | 10 | 9.35% | 1 | 25.00% |
Wenji Huang | 1 | 0.93% | 1 | 25.00% |
Total | 107 | 100.00% | 4 | 100.00% |
static void tracing_sched_unregister(void)
{
unregister_trace_sched_switch(probe_sched_switch, NULL);
unregister_trace_sched_wakeup_new(probe_sched_wakeup, NULL);
unregister_trace_sched_wakeup(probe_sched_wakeup, NULL);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Mathieu Desnoyers | 23 | 79.31% | 2 | 66.67% |
Steven Rostedt | 6 | 20.69% | 1 | 33.33% |
Total | 29 | 100.00% | 3 | 100.00% |
static void tracing_start_sched_switch(int ops)
{
bool sched_register = (!sched_cmdline_ref && !sched_tgid_ref);
mutex_lock(&sched_register_mutex);
switch (ops) {
case RECORD_CMDLINE:
sched_cmdline_ref++;
break;
case RECORD_TGID:
sched_tgid_ref++;
break;
}
if (sched_register && (sched_cmdline_ref || sched_tgid_ref))
tracing_sched_register();
mutex_unlock(&sched_register_mutex);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Joel Fernandes | 38 | 58.46% | 1 | 20.00% |
Frédéric Weisbecker | 17 | 26.15% | 2 | 40.00% |
Mathieu Desnoyers | 9 | 13.85% | 1 | 20.00% |
Ingo Molnar | 1 | 1.54% | 1 | 20.00% |
Total | 65 | 100.00% | 5 | 100.00% |
static void tracing_stop_sched_switch(int ops)
{
mutex_lock(&sched_register_mutex);
switch (ops) {
case RECORD_CMDLINE:
sched_cmdline_ref--;
break;
case RECORD_TGID:
sched_tgid_ref--;
break;
}
if (!sched_cmdline_ref && !sched_tgid_ref)
tracing_sched_unregister();
mutex_unlock(&sched_register_mutex);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Joel Fernandes | 26 | 50.00% | 1 | 20.00% |
Mathieu Desnoyers | 14 | 26.92% | 1 | 20.00% |
Frédéric Weisbecker | 11 | 21.15% | 2 | 40.00% |
Ingo Molnar | 1 | 1.92% | 1 | 20.00% |
Total | 52 | 100.00% | 5 | 100.00% |
void tracing_start_cmdline_record(void)
{
tracing_start_sched_switch(RECORD_CMDLINE);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Steven Rostedt | 9 | 75.00% | 1 | 50.00% |
Joel Fernandes | 3 | 25.00% | 1 | 50.00% |
Total | 12 | 100.00% | 2 | 100.00% |
void tracing_stop_cmdline_record(void)
{
tracing_stop_sched_switch(RECORD_CMDLINE);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Steven Rostedt | 7 | 58.33% | 1 | 50.00% |
Joel Fernandes | 5 | 41.67% | 1 | 50.00% |
Total | 12 | 100.00% | 2 | 100.00% |
void tracing_start_tgid_record(void)
{
tracing_start_sched_switch(RECORD_TGID);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Joel Fernandes | 12 | 100.00% | 1 | 100.00% |
Total | 12 | 100.00% | 1 | 100.00% |
void tracing_stop_tgid_record(void)
{
tracing_stop_sched_switch(RECORD_TGID);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Joel Fernandes | 10 | 83.33% | 1 | 50.00% |
Steven Rostedt | 2 | 16.67% | 1 | 50.00% |
Total | 12 | 100.00% | 2 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Joel Fernandes | 158 | 35.03% | 1 | 6.25% |
Mathieu Desnoyers | 157 | 34.81% | 2 | 12.50% |
Steven Rostedt | 79 | 17.52% | 4 | 25.00% |
Frédéric Weisbecker | 35 | 7.76% | 2 | 12.50% |
Ingo Molnar | 16 | 3.55% | 3 | 18.75% |
Peter Zijlstra | 3 | 0.67% | 1 | 6.25% |
Wenji Huang | 1 | 0.22% | 1 | 6.25% |
Zhao Lei | 1 | 0.22% | 1 | 6.25% |
Greg Kroah-Hartman | 1 | 0.22% | 1 | 6.25% |
Total | 451 | 100.00% | 16 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.