ChampSim
champsim_tracer.cpp File Reference
#include <fstream>
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <string>
#include "../../inc/trace_instruction.h"
#include "pin.H"
Include dependency graph for champsim_tracer.cpp:

Typedefs

using trace_instr_format_t = input_instr
 

Functions

KNOB< std::string > KnobOutputFile (KNOB_MODE_WRITEONCE, "pintool", "o", "champsim.trace", "specify file name for Champsim tracer output")
 
KNOB< UINT64KnobSkipInstructions (KNOB_MODE_WRITEONCE, "pintool", "s", "0", "How many instructions to skip before tracing begins")
 
KNOB< UINT64KnobTraceInstructions (KNOB_MODE_WRITEONCE, "pintool", "t", "1000000", "How many instructions to trace")
 
INT32 Usage ()
 
void ResetCurrentInstruction (VOID *ip)
 
BOOL ShouldWrite ()
 
void WriteCurrentInstruction ()
 
void BranchOrNot (UINT32 taken)
 
template<typename T >
void WriteToSet (T *begin, T *end, UINT32 r)
 
VOID Instruction (INS ins, VOID *v)
 
VOID Fini (INT32 code, VOID *v)
 
int main (int argc, char *argv[])
 

Variables

UINT64 instrCount = 0
 
std::ofstream outfile
 
trace_instr_format_t curr_instr
 

Detailed Description

This is an example of the PIN tool that demonstrates some basic PIN APIs and could serve as the starting point for developing your first PIN tool

Typedef Documentation

◆ trace_instr_format_t

Function Documentation

◆ BranchOrNot()

void BranchOrNot ( UINT32  taken)

◆ Fini()

VOID Fini ( INT32  code,
VOID *  v 
)

Print out analysis results. This function is called when the application exits.

Parameters
[in]codeexit code of the application
[in]vvalue specified by the tool in the PIN_AddFiniFunction function call

◆ Instruction()

VOID Instruction ( INS  ins,
VOID *  v 
)

◆ KnobOutputFile()

KNOB<std::string> KnobOutputFile ( KNOB_MODE_WRITEONCE  ,
"pintool"  ,
"o"  ,
"champsim.trace"  ,
"specify file name for Champsim tracer output"   
)

◆ KnobSkipInstructions()

KNOB<UINT64> KnobSkipInstructions ( KNOB_MODE_WRITEONCE  ,
"pintool"  ,
"s"  ,
"0"  ,
"How many instructions to skip before tracing begins"   
)

◆ KnobTraceInstructions()

KNOB<UINT64> KnobTraceInstructions ( KNOB_MODE_WRITEONCE  ,
"pintool"  ,
"t"  ,
"1000000"  ,
"How many instructions to trace  
)

◆ main()

int main ( int  argc,
char *  argv[] 
)

The main procedure of the tool. This function is called when the application image is loaded but not yet started.

Parameters
[in]argctotal number of elements in the argv array
[in]argvarray of command line arguments, including pin -t <toolname> – ...

◆ ResetCurrentInstruction()

void ResetCurrentInstruction ( VOID *  ip)

◆ ShouldWrite()

BOOL ShouldWrite ( )

◆ Usage()

INT32 Usage ( )

Print out help message.

◆ WriteCurrentInstruction()

void WriteCurrentInstruction ( )

◆ WriteToSet()

template<typename T >
void WriteToSet ( T *  begin,
T *  end,
UINT32  r 
)

Variable Documentation

◆ curr_instr

◆ instrCount

UINT64 instrCount = 0

◆ outfile

std::ofstream outfile