opd_extended.h revision 5a4eb4eb367eccd4b976d1feae96cea96d2c50f2
1/**
2 * @file opd_extended.h
3 * OProfile Extended Feature
4 *
5 * @remark Copyright 2007-2009 OProfile authors
6 * @remark Read the file COPYING
7 *
8 * @author Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
9 * Copyright (c) 2009 Advanced Micro Devices, Inc.
10 */
11
12#ifndef OPD_EXTENDED_H
13#define OPD_EXTENDED_H
14
15#include "opd_trans.h"
16#include "odb.h"
17
18#include <stdlib.h>
19#include <stdint.h>
20
21
22/**
23 * OProfile Extended Feature Table Entry
24 */
25struct opd_ext_feature {
26	// Feature name
27	const char* feature;
28	// Feature handlers
29	struct opd_ext_handlers * handlers;
30};
31
32/**
33 * OProfile Extended handlers
34 */
35struct opd_ext_handlers {
36	// Extended init
37	int (*ext_init)(char const *);
38	// Extended statistics
39	int (*ext_print_stats)();
40	// Extended sfile handlers
41	struct opd_ext_sfile_handlers * ext_sfile;
42};
43
44/**
45 * OProfile Extended sub-handlers (sfile)
46 */
47struct opd_ext_sfile_handlers {
48	int (*create)(struct sfile *);
49	int (*dup)(struct sfile *, struct sfile *);
50	int (*close)(struct sfile *);
51	int (*sync)(struct sfile *);
52	odb_t * (*get)(struct transient const *, int);
53	struct opd_event * (*find_counter_event)(unsigned long);
54};
55
56/**
57 * @param value: commandline input option string
58 *
59 * Parse the specified extended feature
60 */
61extern int opd_ext_initialize(char const * value);
62
63/**
64 * Print out extended feature statistics in oprofiled.log file
65 */
66extern void opd_ext_print_stats();
67
68/**
69 * opd_sfile extended sfile handling functions
70 */
71extern void opd_ext_sfile_create(struct sfile * sf);
72extern void opd_ext_sfile_dup (struct sfile * to, struct sfile * from);
73extern void opd_ext_sfile_close(struct sfile * sf);
74extern void opd_ext_sfile_sync(struct sfile * sf);
75extern odb_t * opd_ext_sfile_get(struct transient const * trans, int is_cg);
76
77/**
78 * @param counter: counter index
79 *
80 * Get event struct opd_event from the counter index value.
81 */
82extern struct opd_event * opd_ext_find_counter_event(unsigned long counter);
83
84
85#endif
86