X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=dol%2Fsrc%2Fdol%2Fvisitor%2Fhds%2Flib%2FPerformance_Extraction.h;fp=dol%2Fsrc%2Fdol%2Fvisitor%2Fhds%2Flib%2FPerformance_Extraction.h;h=f12269633629a93b13f562cc3797c4351f537abc;hb=8c411cf24ed0eb889191aaeafd8fa1e69081df42;hp=0000000000000000000000000000000000000000;hpb=dea7a4fb1ed110d3ce6e6d9255103d724bd66c0e;p=jump.git diff --git a/dol/src/dol/visitor/hds/lib/Performance_Extraction.h b/dol/src/dol/visitor/hds/lib/Performance_Extraction.h new file mode 100644 index 0000000..f122696 --- /dev/null +++ b/dol/src/dol/visitor/hds/lib/Performance_Extraction.h @@ -0,0 +1,67 @@ +#ifndef _PERFORMANCE_EXTRACTION_H +#define _PERFORMANCE_EXTRACTION_H + +#include +#include +#include "trace.h" + +#define SYS_OVERHEAD 1400 //what should be exact vale +#define HOST_FREQUENCY 3 //Ghz + +typedef struct COMP_ENTRY { + int start_line; + int end_line; + double total_computation_time; + int called_times; + COMP_ENTRY *next; +} COMP_ENTRY; + +typedef struct CURRENT_TIME { + struct timespec ts; +}CURRENT_TIME; + +extern int get_current_time(CURRENT_TIME *current_time_ptr); +extern double sub_time(CURRENT_TIME *start_time_ptr, CURRENT_TIME *end_time_ptr); + +class Process_Performance +{ +private: + char _process_name[NAME_LENGTH]; + COMP_ENTRY *_head; + COMP_ENTRY *_tail; + +public: + Process_Performance(const char *process_name); + ~Process_Performance(); + + const char *get_name(); + COMP_ENTRY * add_entry(int start_line, int end_line); + int set_entry(int start_line, int end_line, CURRENT_TIME *start_time_ptr, + CURRENT_TIME *end_time_ptr); + COMP_ENTRY *get_entry(int start_line, int end_line); + COMP_ENTRY *get_head_entry(); +}; + +class Performance_Extraction +{ +private: + char _processor_type[NAME_LENGTH]; + char _chr_file_name[NAME_LENGTH]; + list _list_process_performance; + list::iterator _iter_process_performance; + +public: + Performance_Extraction(const char *chr_file_name); + ~Performance_Extraction(); + + int add_computation_performance(const char *process_name, int start_line, + int end_line, CURRENT_TIME *start_time_ptr, + CURRENT_TIME *end_time_ptr); + Process_Performance *get_process_performance(const char *process_name); + int write_to_xml_file(const char *chr_file_name); + int add_to_xml_file(const char *chr_file_name); +}; + +extern Performance_Extraction performance_extraction; + +#endif