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 (at) 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 */ 25 struct 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 */ 35 struct opd_ext_handlers { 36 // Extended init 37 int (*ext_init)(char const *); 38 // Extended deinit 39 int (*ext_deinit)(); 40 // Extended statistics 41 int (*ext_print_stats)(); 42 // Extended sfile handlers 43 struct opd_ext_sfile_handlers * ext_sfile; 44 }; 45 46 /** 47 * OProfile Extended sub-handlers (sfile) 48 */ 49 struct opd_ext_sfile_handlers { 50 int (*create)(struct sfile *); 51 int (*dup)(struct sfile *, struct sfile *); 52 int (*close)(struct sfile *); 53 int (*sync)(struct sfile *); 54 odb_t * (*get)(struct transient const *, int); 55 struct opd_event * (*find_counter_event)(unsigned long); 56 }; 57 58 /** 59 * @param value: commandline input option string 60 * 61 * Parse the specified extended feature 62 */ 63 extern int opd_ext_initialize(char const * value); 64 65 /** 66 * @param value: commandline input option string 67 * 68 * Deinitialize 69 */ 70 extern int opd_ext_deinitialize(); 71 72 /** 73 * Print out extended feature statistics in oprofiled.log file 74 */ 75 extern void opd_ext_print_stats(); 76 77 /** 78 * opd_sfile extended sfile handling functions 79 */ 80 extern void opd_ext_sfile_create(struct sfile * sf); 81 extern void opd_ext_sfile_dup (struct sfile * to, struct sfile * from); 82 extern void opd_ext_sfile_close(struct sfile * sf); 83 extern void opd_ext_sfile_sync(struct sfile * sf); 84 extern odb_t * opd_ext_sfile_get(struct transient const * trans, int is_cg); 85 86 /** 87 * @param counter: counter index 88 * 89 * Get event struct opd_event from the counter index value. 90 */ 91 extern struct opd_event * opd_ext_find_counter_event(unsigned long counter); 92 93 94 #endif 95