aboutsummaryrefslogtreecommitdiffstats
path: root/kernel-shark/src/plugins/sched_events.h
blob: 0beb63fe2b48df2984182c3a24d13022ac09ba32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* SPDX-License-Identifier: LGPL-2.1 */

/*
 * Copyright (C) 2017 VMware Inc, Yordan Karadzhov <y.karadz@gmail.com>
 */

/**
 *  @file    sched_events.h
 *  @brief   Plugin for Sched events.
 */

#ifndef _KS_PLUGIN_SHED_H
#define _KS_PLUGIN_SHED_H

// KernelShark
#include "libkshark.h"

#ifdef __cplusplus
extern "C" {
#endif

/** Structure representing a plugin-specific context. */
struct plugin_sched_context {
	/** Input handle for the trace data file. */
	struct tracecmd_input	*handle;

	/** Page event used to parse the page. */
	struct tep_handle	*pevent;

	/** Pointer to the sched_switch_event object. */
	struct tep_event	*sched_switch_event;

	/** Pointer to the sched_switch_next_field format descriptor. */
	struct tep_format_field	*sched_switch_next_field;

	/** Pointer to the sched_switch_comm_field format descriptor. */
	struct tep_format_field	*sched_switch_comm_field;

	/** Pointer to the sched_switch_prev_state_field format descriptor. */
	struct tep_format_field	*sched_switch_prev_state_field;

	/** Pointer to the sched_wakeup_event object. */
	struct tep_event	*sched_wakeup_event;

	/** Pointer to the sched_wakeup_pid_field format descriptor. */
	struct tep_format_field	*sched_wakeup_pid_field;

	/** Pointer to the sched_wakeup_new_event object. */
	struct tep_event	*sched_wakeup_new_event;

	/** Pointer to the sched_wakeup_new_pid_field format descriptor. */
	struct tep_format_field	*sched_wakeup_new_pid_field;

	/** List of Data collections used by this plugin. */
	struct kshark_entry_collection	*collections;

	/** Hash of the tasks for which the second pass is already done. */
	struct tracecmd_filter_id	*second_pass_hash;
};

int plugin_get_next_pid(struct tep_record *record);

bool plugin_wakeup_match_rec_pid(struct kshark_context *kshark_ctx,
				 struct kshark_entry *e, int pid);

bool plugin_switch_match_rec_pid(struct kshark_context *kshark_ctx,
				 struct kshark_entry *e, int pid);

bool plugin_switch_match_entry_pid(struct kshark_context *kshark_ctx,
				   struct kshark_entry *e,
				   int pid);

bool plugin_match_pid(struct kshark_context *kshark_ctx,
		      struct kshark_entry *e, int pid);

void plugin_draw(struct kshark_cpp_argv *argv, int pid, int draw_action);

#ifdef __cplusplus
}
#endif

#endif