From: Suravee S. <sur...@am...> - 2009-03-27 21:37:38
|
Revision 3 Note: - Design changes in based on Maynard's recommendation from revision2. * Replacing "ext_features" to "ext_feature" * Changing the usage message for "--ext-feature" option. - Adding the function "is_ext_sfile_enabled()" function in daemon/opd_extended.c to enhance the sanity check in each opd_ext_sfile_XXX wrapper. ---------------------------------- Design Summary (Revision3): * New oprofiled command line interface -x|--ext-feature=<extended-feature-name>:[args] This option enable a specific extended feature name, and arguments. * "opd_ext_feature" structure contains information for each extended feature including feature name, and a structure containing handlers function. struct opd_ext_feature { const char* feature; // Feature name struct opd_ext_handlers *handlers; // Feature handlers }; * "opd_ext_handlers" structure contains handlers for each extended feature. o ext_init: handle the initialization of the feature at the beginning when oprofiled parsing the command line options (oprofiled.c). o ext_print_stats: will print out the statistics summary in the oprofiled.log file at the end of the run (daemon/opd_stat.c). o ext_sfle: a pointer to structure containing handlers for the operations necessary to extend opd_sfile (daemon/opd_sfile.c). struct opd_ext_handlers { int (*ext_init)(char const * ); // Extended init int (*ext_print_stats)(); // Extended statistics struct opd_ext_sfile_handlers *ext_sfile; // Extended sfile handlers (optional) }; struct opd_ext_sfile_handlers { void (*create)(struct sfile *, struct transient const *); void (*dup)(struct sfile *, struct sfile * ); void (*close)(struct sfile *); void (*sync)(struct sfile *); odb_t * (*get)(struct transient const * , int ); struct opd_event * (*find_counter_event)(unsigned long); }; * Extended Feature Table: This is a global table of "struct opd_ext_feature" described above. Each extended feature must be listed here. struct opd_ext_feature ext_feature_table[] = { {"feature1", &feature1_handlers}, {"feature2", &feature2_handlers}, {"feature3", &feature3_handlers}, {....}, {NULL, NULL} }; * Extend the "struct sfile" in opd_sfile.h by adding "odb_t * ext_file". * Typically, opcontrol uses ophelp to determine how to program a set of performance counters with the specified events. To handle the new extended events: 1. A new tag "ext" will be used by extended events, which does not use the actual performance counter. - Traditional events event:0x76 counters:0,1,2,3 um:zero minimum:5000 name:CPU_CLK_UNHALTED : Cpu unhalted clock cycle */ ophelp --check-events=CPU_CLK_UNHALTED:100000 ---> 0 - Extended events event:0xf00 ext:ibs_fetch um:zero minimum:100000 name:IBS_FETCH_ALL : All IBS fetch samples */ ophelp --check-events=IBS_FETCH_ALL:100000 ---> ibs_fetch 2. Extend "ophelp --check-events" to support extended events. The output will be the appropriate counters assignment based on the provided events. For instance, ophelp --check-events CPU_CLK_UNHALTED:100000 \ IBS_FETCH_ALL:100000 \ --> (extended event) IBS_OP_ALL:100000 \ --> (extended event) RETIRED_INSTRUCTIONS:100000 \ DATA_CACHE_MISSES:100000 \ DATA_CACHE_ACCESSES:100000 will generate output "0 ibs_fetch ibs_op 1 2 3". 3. Modify the function "map_event_to_counter" so that the entries of "counter_map" will contain "-1" for the extended events. For instance, the above input will generate counter_map with contents "0 -1 -1 1 2 3". "ophelp" will then map the entry with counter_map value "-1" to the appropriate value, which is specified with tag "ext" in the events file. |