Traces

Examples Index

Traces

To enable Tracing, set environment variable:

export DASH_ENABLE_TRACE=on
dash::Array<double> array(SIZE);

// Enable tracing:
dash::util::TraceStore::on();
// Clear existing trace data, if any:
dash::util::TraceStore::clear();

dash::util::Trace trace("trace context name");

for (int k = 0; k < num_blocks; k++) {
  auto block = array.block(k);
  double * local_copy = new double[block.size()];

  trace.enter_state("copy");
  dash::copy(block.begin(), block.end(), local_copy);
  trace.exit_state("copy");

  trace.enter_state("compute");
  do_computation(local_copy);
  trace.exit_state("compute");
}
trace.enter_state("barrier");
array.barrier();
trace.exit_state("barrier");

// Disable tracing:
dash::util::TraceStore::off();

// Default trace output format is CSV with columns
//   "context", "unit", "start", "end", "state"
// Write to STDOUT:
dash::util::TraceStore::write(std::cout);
// Write to file:
dash::util::TraceStore::write("tracedata.csv");