void activate() { //FIXME: only one aligner at a time -- not changing output file //name based on a static count of the number of sse_aligner_t //objects. if (knob_verbose) { string filename = knob_output_file.Value(); if( knob_pid ) filename += "." + decstr( getpid_portable() ); out = new std::ofstream(filename.c_str()); } realign_stores = (knob_stores==1); realign_loads = (knob_loads==1); verbose = (knob_verbose==1); // obtain a key for TLS storage tls_key = PIN_CreateThreadDataKey(0); PIN_AddThreadStartFunction(thread_start, this); PIN_AddThreadFiniFunction(thread_fini, this); TRACE_AddInstrumentFunction(instrument_trace, this); if (verbose) *out << "sse aligner activated" << endl; }
VOID Fini(int, VOID * v) { string filename = KnobOutputFile.Value(); if( KnobPid ) { filename += "." + decstr( getpid_portable() ); } std::ofstream out(filename.c_str()); DumpStats(out); out << "# $eof" << endl; out.close(); }
int main(int argc, char *argv[]) { if( PIN_Init(argc,argv) ) { return Usage(); } string filename = KnobOutputFile.Value(); if( KnobPid ) filename += "." + decstr( getpid_portable() ); out = new std::ofstream(filename.c_str()); INS_AddInstrumentFunction(Instruction, 0); PIN_AddFiniFunction(Fini, 0); // Never returns PIN_StartProgram(); return 0; }