Skip to content

Commit 4535d6a

Browse files
committed
Only define profilingCounter when in profiling mode
1 parent 2435418 commit 4535d6a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

external/Stats.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ void finalizeStats(sycl::queue myQueue, std::vector<float> averageForces,
9898
auto durationSumBuf = sycl::buffer<int>(&durationSum, 1);
9999

100100
auto kernelDurationsForOutput = kernelDurations;
101+
// Discard first kernel time to prevent skewed results
101102
kernelDurations.erase(kernelDurations.begin());
102103
auto kernelDurationsBuf =
103104
sycl::buffer<int>(kernelDurations.data(), kernelDurations.size());

src/main.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,11 @@ int main(int argc, char *argv[]) {
194194

195195
int delayCounter = 0;
196196
int updateBBoxCounter = 0;
197-
int profilingCounter = 0;
198197
int timestepCounter = 0;
199198
bool isPause = false;
200199
#ifndef PROFILING_MODE
201200
SDL_Event event;
201+
bool isQuit = false;
202202
#endif
203203

204204
// Initialise stats variables if STATS flag is true
@@ -214,11 +214,13 @@ int main(int argc, char *argv[]) {
214214
auto globalStart = std::chrono::high_resolution_clock::now();
215215
#endif
216216

217-
while (profilingCounter <= 500) {
218-
#ifndef PROFILING_MODE
217+
#ifdef PROFILING_MODE
218+
while (timestepCounter <= 500) {
219+
#else
220+
while(!isQuit) {
219221
if (SDL_PollEvent(&event)) {
220222
if (event.type == SDL_QUIT) {
221-
profilingCounter = 501;
223+
isQuit = true;
222224
} else if (event.type == SDL_KEYDOWN &&
223225
event.key.keysym.sym == SDLK_SPACE) {
224226
isPause = !isPause;
@@ -267,9 +269,6 @@ int main(int argc, char *argv[]) {
267269
updateBBoxCounter--;
268270

269271
timestepCounter++;
270-
#ifdef PROFILING_MODE
271-
profilingCounter++;
272-
#endif
273272
} else {
274273
delayCounter++;
275274
}

0 commit comments

Comments
 (0)