aboutsummaryrefslogtreecommitdiff
path: root/libop/op_mangle.h
blob: 9b600dc977988454b5c6ec3939b6f3374aa94b71 (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
/**
 * @file op_mangle.h
 * Mangling of sample file names
 *
 * @remark Copyright 2002 OProfile authors
 * @remark Read the file COPYING
 *
 * @author John Levon
 * @author Philippe Elie
 */

#ifndef OP_MANGLE_H
#define OP_MANGLE_H

#include <sys/types.h>

#ifdef __cplusplus
extern "C" {
#endif

enum mangle_flags {
	MANGLE_NONE      = 0,
	MANGLE_CPU       = (1 << 0),
	MANGLE_TGID      = (1 << 1),
	MANGLE_TID       = (1 << 2),
	MANGLE_KERNEL    = (1 << 3),
	MANGLE_CALLGRAPH = (1 << 4),
	MANGLE_ANON      = (1 << 5),
	MANGLE_CG_ANON   = (1 << 6),
};

/**
 * Temporary structure for passing parameters to
 * op_mangle_filename.
 */
struct mangle_values {
	int flags;

	char const * image_name;
	char const * anon_name;
	char const * dep_name;
	char const * cg_image_name;
	char const * event_name;
	int count;
	unsigned int unit_mask;
	pid_t tgid;
	pid_t tid;
	int cpu;
};

/**
 * op_mangle_filename - mangle a sample filename
 * @param values  parameters to use as mangling input
 *
 * See also PP:3 for the encoding scheme
 *
 * Returns a char* pointer to the mangled string. Caller
 * is responsible for freeing this string.
 */
char * op_mangle_filename(struct mangle_values const * values);

#ifdef __cplusplus
}
#endif

#endif /* OP_MANGLE_H */