Skip to content

Commit

Permalink
added error
Browse files Browse the repository at this point in the history
  • Loading branch information
hariharan-devarajan committed Sep 30, 2024
1 parent 7538d23 commit 892174a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/dftracer/df_logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ class DFTLogger {
if (metadata != nullptr) {
metadata->insert_or_assign("level", level);
int parent_index_value = get_parent();
metadata->insert_or_assign("p_idx", parent_index_value);
ConstEventNameType pidx = "p_idx";
metadata->insert_or_assign(pidx, parent_index_value);
}
#ifdef DFTRACER_MPI_ENABLE
if (!mpi_event) {
Expand Down
9 changes: 5 additions & 4 deletions src/dftracer/writer/chrome_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,18 @@ void dftracer::ChromeWriter::finalize(bool has_entry) {
DFTRACER_LOG_INFO("Profiler writing the final symbol", "");
fh = fopen(this->filename.c_str(), "r+");
if (fh == nullptr) {
DFTRACER_LOG_ERROR("unable to open log file %s with O_WRONLY",
this->filename.c_str()); // GCOVR_EXCL_LINE
DFTRACER_LOG_ERROR(
"unable to open log file %s with O_WRONLY error_code %d",
this->filename.c_str(), errno); // GCOVR_EXCL_LINE
} else {
std::string data = "[\n";
auto written_elements =
fwrite(data.c_str(), sizeof(char), data.size(), fh);
if (written_elements != data.size()) { // GCOVR_EXCL_START
DFTRACER_LOG_ERROR(
"unable to finalize log write %s for O_WRONLY written only %ld "
"of %ld",
filename.c_str(), data.size(), written_elements);
"of %ld with error %d",
filename.c_str(), data.size(), written_elements, errno);
} // GCOVR_EXCL_STOP
data = "]";
fseek(fh, 0, SEEK_END);
Expand Down

0 comments on commit 892174a

Please sign in to comment.