/**************************************************************************** ** TAU Portable Profiling Package ** ** http://www.cs.uoregon.edu/research/tau ** ***************************************************************************** ** Copyright 1999 ** ** Department of Computer and Information Science, University of Oregon ** ** Advanced Computing Laboratory, Los Alamos National Laboratory ** ****************************************************************************/ /*************************************************************************** ** File : tau_selective.cpp ** ** Description : Provides selective instrumentation support in ** ** TAU. ** ** Author : Sameer Shende ** ** Contact : sameer@cs.uoregon.edu sameer@acl.lanl.gov ** ** Documentation : See http://www.cs.uoregon.edu/research/tau ** ***************************************************************************/ #include #include #include #include #include #include #include "tau_instrument.h" #include #include using namespace std; #define BEGIN_EXCLUDE_TOKEN "BEGIN_EXCLUDE_LIST" #define END_EXCLUDE_TOKEN "END_EXCLUDE_LIST" #define BEGIN_INCLUDE_TOKEN "BEGIN_INCLUDE_LIST" #define END_INCLUDE_TOKEN "END_INCLUDE_LIST" #define BEGIN_FILE_INCLUDE_TOKEN "BEGIN_FILE_INCLUDE_LIST" #define END_FILE_INCLUDE_TOKEN "END_FILE_INCLUDE_LIST" #define BEGIN_FILE_EXCLUDE_TOKEN "BEGIN_FILE_EXCLUDE_LIST" #define END_FILE_EXCLUDE_TOKEN "END_FILE_EXCLUDE_LIST" #define BEGIN_INSTRUMENT_SECTION "BEGIN_INSTRUMENT_SECTION" #define END_INSTRUMENT_SECTION "END_INSTRUMENT_SECTION" list excludelist; list includelist; list fileincludelist; list fileexcludelist; /* prototypes used in this file */ bool wildcardCompare(char *wild, char *string, char kleenestar); void parseInstrumentationCommand(char *command, int lineno); void printInstrumentList(void); /* -------------------------------------------------------------------------- */ /* -- Read the instrumentation requests file. ------------------------------- */ /* -------------------------------------------------------------------------- */ int processInstrumentationRequests(char *fname) { ifstream input(fname); char line[INBUF_SIZE]; char* inbuf; int lineno = 0; if (!input) { cout << "ERROR: Cannot open file: " << fname<::iterator it = excludelist.begin(); it != excludelist.end(); it++) cout <<"Exclude Item: "<<*it<::iterator it = includelist.begin(); it != includelist.end(); it++) cout <<"Include Item: "<<*it<::iterator it = fileincludelist.begin(); it != fileincludelist.end(); it++) cout <<"File Include Item: "<<*it<::iterator it = fileexcludelist.begin(); it != fileexcludelist.end(); it++) cout <<"File Include Item: "<<*it<::iterator it; #ifdef DEBUG cout <<"instrument "<::iterator it; if (!fileexcludelist.empty()) { /* if exclude list has entries */ for (it = fileexcludelist.begin(); it != fileexcludelist.end(); it++) { /* iterate through the entries and see if the names match. Use '*' as the kleene star operator */ if (wildcardCompare((char *)((*it).c_str()), (char *) (file_name.c_str()), '*')) { /* names match! This routine should not be instrumented */ #ifdef DEBUG cout <<"Don't instrument: "<