aboutsummaryrefslogtreecommitdiff
path: root/daemon/opd_extended.h
blob: d7682a4e70bdc770e0b942f7cf93c44da63dcb0b (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
83
84
85
86
87
88
89
90
91
92
93
94
/**
 * @file opd_extended.h
 * OProfile Extended Feature
 *
 * @remark Copyright 2007-2009 OProfile authors
 * @remark Read the file COPYING
 *
 * @author Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
 * Copyright (c) 2009 Advanced Micro Devices, Inc.
 */

#ifndef OPD_EXTENDED_H
#define OPD_EXTENDED_H

#include "opd_trans.h"
#include "odb.h"

#include <stdlib.h>
#include <stdint.h>


/**
 * OProfile Extended Feature Table Entry
 */
struct opd_ext_feature {
	// Feature name
	const char* feature;
	// Feature handlers
	struct opd_ext_handlers * handlers;
};

/**
 * OProfile Extended handlers
 */
struct opd_ext_handlers {
	// Extended init
	int (*ext_init)(char const *);
	// Extended deinit 
	int (*ext_deinit)();
	// Extended statistics
	int (*ext_print_stats)();
	// Extended sfile handlers
	struct opd_ext_sfile_handlers * ext_sfile;
};

/**
 * OProfile Extended sub-handlers (sfile)
 */
struct opd_ext_sfile_handlers {
	int (*create)(struct sfile *);
	int (*dup)(struct sfile *, struct sfile *);
	int (*close)(struct sfile *);
	int (*sync)(struct sfile *);
	odb_t * (*get)(struct transient const *, int);
	struct opd_event * (*find_counter_event)(unsigned long);
};

/**
 * @param value: commandline input option string
 *
 * Parse the specified extended feature
 */
extern int opd_ext_initialize(char const * value);

/**
 * @param value: commandline input option string
 *
 * Deinitialize
 */
extern int opd_ext_deinitialize();

/**
 * Print out extended feature statistics in oprofiled.log file
 */
extern void opd_ext_print_stats();

/**
 * opd_sfile extended sfile handling functions
 */
extern void opd_ext_sfile_create(struct sfile * sf);
extern void opd_ext_sfile_dup (struct sfile * to, struct sfile * from);
extern void opd_ext_sfile_close(struct sfile * sf);
extern void opd_ext_sfile_sync(struct sfile * sf);
extern odb_t * opd_ext_sfile_get(struct transient const * trans, int is_cg);

/**
 * @param counter: counter index
 *
 * Get event struct opd_event from the counter index value.
 */
extern struct opd_event * opd_ext_find_counter_event(unsigned long counter);


#endif