Skip to content

Commit

Permalink
Make sure to initialize the counter buffer to zero when recording mul…
Browse files Browse the repository at this point in the history
…tiple counters.

Former-commit-id: a643844d4346f70a7ea8347c9dc37a2eaccae2e8
  • Loading branch information
Scott Biersdorff committed Sep 17, 2013
1 parent e10f3fc commit d9ca9ed
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/Profile/CuptiLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,13 @@ void Tau_CuptiLayer_read_counters(int device, uint64_t * counterDataBuffer)
//printf("total instances avaiable: %ld.\n", numTotalInstances);

//in case no events were read.
counterDataBuffer[0] = 0;
for (int i=0; i<Tau_CuptiLayer_get_num_events(); i++)
{
counterDataBuffer[i] = 0;

//printf("init events, values %d => %llu.\n",
//i, counterDataBuffer[i]);
}

int e = 0;
//sum data.
Expand Down Expand Up @@ -452,13 +458,17 @@ void Tau_CuptiLayer_read_counters(int device, uint64_t * counterDataBuffer)
#endif
//if ( events_read != ( size_t ) Tau_CuptiLayer_num_events )
//TODO error return -1;

//printf("cupti last values %llu.\n",
//lastDataBuffer[0]);


//printf("cupti events, values %llu.\n",
//counterDataBuffer[0]);


for (int i=0; i<Tau_CuptiLayer_get_num_events(); i++)
{
//printf("cupti last values %d => %llu.\n",
//i, lastDataBuffer[i]);

//printf("cupti events, values %d => %llu.\n",
//i, counterDataBuffer[i]);
}

//accumulate counter values.
for (int i=0; i<Tau_CuptiLayer_get_num_events(); i++)
Expand Down

0 comments on commit d9ca9ed

Please sign in to comment.