Skip to content
Merged
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
21 changes: 16 additions & 5 deletions src/coverage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,26 +77,37 @@ JL_DLLEXPORT uint64_t *jl_malloc_data_pointer(StringRef filename, int line)
return allocLine(mallocData[filename], line);
}

// Resets the malloc counts.
extern "C" JL_DLLEXPORT void jl_clear_malloc_data(void)
static void clear_log_data(logdata_t &logData, int resetValue)
{
logdata_t::iterator it = mallocData.begin();
for (; it != mallocData.end(); it++) {
logdata_t::iterator it = logData.begin();
for (; it != logData.end(); it++) {
SmallVector<logdata_block*, 0> &bytes = (*it).second;
SmallVector<logdata_block*, 0>::iterator itb;
for (itb = bytes.begin(); itb != bytes.end(); itb++) {
if (*itb) {
logdata_block &data = **itb;
for (int i = 0; i < logdata_blocksize; i++) {
if (data[i] > 0)
data[i] = 1;
data[i] = resetValue;
}
}
}
}
jl_gc_sync_total_bytes(0);
}

// Resets the malloc counts.
extern "C" JL_DLLEXPORT void jl_clear_malloc_data(void)
{
clear_log_data(mallocData, 1);
}

// Resets the code coverage
extern "C" JL_DLLEXPORT void jl_clear_coverage_data(void)
{
clear_log_data(coverageData, 0);
}

static void write_log_data(logdata_t &logData, const char *extension)
{
std::string base = std::string(jl_options.julia_bindir);
Expand Down