op_mangle.h revision cc2ee177dbb3befca43e36cfc56778b006c3d050
1/**
2 * @file op_mangle.h
3 * Mangling of sample file names
4 *
5 * @remark Copyright 2002 OProfile authors
6 * @remark Read the file COPYING
7 *
8 * @author John Levon
9 * @author Philippe Elie
10 */
11
12#ifndef OP_MANGLE_H
13#define OP_MANGLE_H
14
15#include <sys/types.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21enum mangle_flags {
22	MANGLE_NONE      = 0,
23	MANGLE_CPU       = (1 << 0),
24	MANGLE_TGID      = (1 << 1),
25	MANGLE_TID       = (1 << 2),
26	MANGLE_KERNEL    = (1 << 3),
27	MANGLE_CALLGRAPH = (1 << 4),
28	MANGLE_ANON      = (1 << 5),
29	MANGLE_CG_ANON   = (1 << 6),
30};
31
32/**
33 * Temporary structure for passing parameters to
34 * op_mangle_filename.
35 */
36struct mangle_values {
37	int flags;
38
39	char const * image_name;
40	char const * dep_name;
41	char const * cg_image_name;
42	char const * event_name;
43	int count;
44	unsigned int unit_mask;
45	pid_t tgid;
46	pid_t tid;
47	int cpu;
48};
49
50/**
51 * op_mangle_filename - mangle a sample filename
52 * @param values  parameters to use as mangling input
53 *
54 * See also PP:3 for the encoding scheme
55 *
56 * Returns a char* pointer to the mangled string. Caller
57 * is responsible for freeing this string.
58 */
59char * op_mangle_filename(struct mangle_values const * values);
60
61#ifdef __cplusplus
62}
63#endif
64
65#endif /* OP_MANGLE_H */
66