Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/rtlib/verbose mode #442

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion DiscoPoP/DiscoPoP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ bool DiscoPoP::doInitialization(Module &M) {

// DPInstrumentationOmission
{
int bbDepCount = 0;
bbDepCount = 0;

initializeBBDepCounter();

ReportBB = M.getOrInsertFunction(
"__dp_report_bb",
Expand Down Expand Up @@ -233,6 +235,15 @@ bool DiscoPoP::doFinalization(Module &M) {
}
}
}
// write the current count of BBs to a file to avoid duplicate BBids
outBBDepCounter = new std::ofstream();
outBBDepCounter->open(".discopop/profiler/DP_BBDepCounter.txt", std::ios_base::out);
if (outBBDepCounter && outBBDepCounter->is_open()) {
*outBBDepCounter << bbDepCount;
outBBDepCounter->flush();
outBBDepCounter->close();
}

// DPInstrumentationOmission end

return true;
Expand Down Expand Up @@ -893,6 +904,15 @@ void DiscoPoP::initializeCUIDCounter() {
}
}

void DiscoPoP::initializeBBDepCounter(){
std::string BBDepCounterFile = ".discopop/profiler/DP_BBDepCounter.txt";
if (dputil::fexists(BBDepCounterFile)) {
std::fstream inBBDepCounter(BBDepCounterFile, std::ios_base::in);;
inBBDepCounter >> bbDepCount;
inBBDepCounter.close();
}
}

bool DiscoPoP::isRecursive(Function &F, CallGraph &CG) {
auto callNode = CG[&F];
for (unsigned i = 0; i < callNode->size(); i++) {
Expand Down
4 changes: 3 additions & 1 deletion DiscoPoP/DiscoPoP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ namespace {
// CUGeneration

static unsigned int CUIDCounter;
static unsigned int bbDepCount;
static bool defaultIsGlobalVariableValue;
int32_t fileID;

Expand Down Expand Up @@ -217,6 +218,7 @@ namespace {
ofstream *outCUs;
ofstream *outOriginalVariables;
ofstream *outCUIDCounter;
ofstream *outBBDepCounter;
// Mohammad 23.12.2020
map <string, string> loopStartLines;

Expand Down Expand Up @@ -319,7 +321,6 @@ namespace {
// DPInstrumentation end

// DPInstrumentationOmission
int bbDepCount;
string bbDepString;
string fileName;
int32_t fid;
Expand Down Expand Up @@ -385,6 +386,7 @@ namespace {

// Output function
void initializeCUIDCounter();
void initializeBBDepCounter();

string xmlEscape(string data);

Expand Down
1 change: 1 addition & 0 deletions docs/Manual_Quickstart/Manual_Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ If you have installed LLVM <b>using the package manager</b>, specifying this var
Note: In case you want to use a specific Version of LLVM, it is possible to specify the `-DUSE_LLVM_VERSION=<version>` flag.

Note: In case your application uses PThreads, please specify `-DDP_PTHREAD_COMPATIBILITY_MODE=1`. Note, however, that this can influence the runtime of the profiling.
Note: In case you require a more verbose output of the runtime library, specify the `-DDP_RTLIB_VERBOSE=1` flag.

Once the configuration process is successfully finished, compile the DiscoPoP libraries using `make`. All created shared objects will be stored in the build directory and can be found inside a folder named `libi/`.

Expand Down
6 changes: 6 additions & 0 deletions rtlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ if(DEFINED DP_PTHREAD_COMPATIBILITY_MODE)
if(NOT ${DP_PTHREAD_COMPATIBILITY_MODE} EQUAL 0)
target_compile_definitions(DiscoPoP_RT PUBLIC DP_PTHREAD_COMPATIBILITY_MODE=${DP_PTHREAD_COMPATIBILITY_MODE})
endif()
endif()

if(DEFINED DP_RTLIB_VERBOSE)
if(NOT ${DP_RTLIB_VERBOSE} EQUAL 0)
target_compile_definitions(DiscoPoP_RT PUBLIC DP_RTLIB_VERBOSE=${DP_RTLIB_VERBOSE})
endif()
endif()
# end of compiler flags

install(TARGETS DiscoPoP_RT ARCHIVE DESTINATION lib)

Expand Down
Loading