File tree Expand file tree Collapse file tree 3 files changed +24
-7
lines changed Expand file tree Collapse file tree 3 files changed +24
-7
lines changed Original file line number Diff line number Diff line change 21
21
22
22
// #define DEBUG_TIME
23
23
#define CPP_MODULE " MAIN"
24
+ #define ITERATIONS 10
24
25
25
26
#define TIMER_START () time_start = std::chrono::steady_clock::now();
26
27
#define TIMER_END () \
@@ -170,7 +171,11 @@ START_TIMER();
170
171
#ifdef DEBUG_TIME
171
172
STOP_TIMER ();
172
173
PRINT_TIMER (" init " );
174
+ #endif
173
175
176
+ std::vector<KeyValue> kvs;
177
+ for (int iter = 0 ; iter < ITERATIONS; iter++){
178
+ #ifdef DEBUG_TIME
174
179
START_TIMER ();
175
180
#endif
176
181
// Allocates device memory for the hashtable and
@@ -231,7 +236,7 @@ PRINT_TIMER("delete_hashtable ");
231
236
START_TIMER ();
232
237
#endif
233
238
// Get all the key-values from the hash table
234
- std::vector<KeyValue> kvs = iterate_hashtable (pHashTable);
239
+ kvs = iterate_hashtable (pHashTable);
235
240
#ifdef DEBUG_TIME
236
241
STOP_TIMER ();
237
242
PRINT_TIMER (" iterate_hashtable " );
@@ -244,9 +249,10 @@ PRINT_TIMER("iterate_hashtable ");
244
249
245
250
destroy_hashtable (pHashTable);
246
251
252
+ }
247
253
TIMER_END ()
248
254
TIMER_PRINT (" hashtable - total time for whole calculation" )
249
- printf (" %f million keys/second\n " , kNumKeyValues / (time_total / 1000 .0f ) / 1000000 .0f );
255
+ printf (" %f million keys/second\n " , kNumKeyValues / (time_total / ITERATIONS / 1000 .0f ) / 1000000 .0f );
250
256
251
257
bool verify = true ;
252
258
if (argc > 1 && strcmp (argv[1 ], " --no-verify" ) == 0 ) {
Original file line number Diff line number Diff line change 21
21
22
22
// #define DEBUG_TIME
23
23
#define CPP_MODULE " MAIN"
24
+ #define ITERATIONS 10
24
25
25
26
#define TIMER_START () time_start = std::chrono::steady_clock::now();
26
27
#define TIMER_END () \
@@ -170,7 +171,11 @@ START_TIMER();
170
171
#ifdef DEBUG_TIME
171
172
STOP_TIMER ();
172
173
PRINT_TIMER (" init " );
174
+ #endif
173
175
176
+ std::vector<KeyValue> kvs;
177
+ for (int iter = 0 ; iter < ITERATIONS; iter++){
178
+ #ifdef DEBUG_TIME
174
179
START_TIMER ();
175
180
#endif
176
181
// Allocates device memory for the hashtable and
@@ -231,7 +236,7 @@ PRINT_TIMER("delete_hashtable ");
231
236
START_TIMER ();
232
237
#endif
233
238
// Get all the key-values from the hash table
234
- std::vector<KeyValue> kvs = iterate_hashtable (pHashTable);
239
+ kvs = iterate_hashtable (pHashTable);
235
240
#ifdef DEBUG_TIME
236
241
STOP_TIMER ();
237
242
PRINT_TIMER (" iterate_hashtable " );
@@ -243,10 +248,10 @@ PRINT_TIMER("iterate_hashtable ");
243
248
// seconds = milliseconds / 1000.0f;
244
249
245
250
destroy_hashtable (pHashTable);
246
-
251
+ }
247
252
TIMER_END ()
248
253
TIMER_PRINT (" hashtable - total time for whole calculation" )
249
- printf (" %f million keys/second\n " , kNumKeyValues / (time_total / 1000 .0f ) / 1000000 .0f );
254
+ printf (" %f million keys/second\n " , kNumKeyValues / (time_total / ITERATIONS / 1000 .0f ) / 1000000 .0f );
250
255
251
256
bool verify = true ;
252
257
if (argc > 1 && strcmp (argv[1 ], " --no-verify" ) == 0 ) {
Original file line number Diff line number Diff line change 21
21
22
22
// #define DEBUG_TIME
23
23
#define CPP_MODULE " MAIN"
24
+ #define ITERATIONS 10
24
25
25
26
#define TIMER_START () time_start = std::chrono::steady_clock::now();
26
27
#define TIMER_END () \
@@ -169,7 +170,11 @@ START_TIMER();
169
170
#ifdef DEBUG_TIME
170
171
STOP_TIMER ();
171
172
PRINT_TIMER (" init " );
173
+ #endif
172
174
175
+ std::vector<KeyValue> kvs;
176
+ for (int iter = 0 ; iter < ITERATIONS; iter++) {
177
+ #ifdef DEBUG_TIME
173
178
START_TIMER ();
174
179
#endif
175
180
// Allocates device memory for the hashtable and
@@ -233,7 +238,7 @@ PRINT_TIMER("delete_hashtable ");
233
238
START_TIMER ();
234
239
#endif
235
240
// Get all the key-values from the hash table
236
- std::vector<KeyValue> kvs = iterate_hashtable (pHashTable, qht);
241
+ kvs = iterate_hashtable (pHashTable, qht);
237
242
#ifdef DEBUG_TIME
238
243
STOP_TIMER ();
239
244
PRINT_TIMER (" iterate_hashtable " );
@@ -246,9 +251,10 @@ PRINT_TIMER("iterate_hashtable ");
246
251
247
252
destroy_hashtable (pHashTable, qht);
248
253
254
+ }
249
255
TIMER_END ()
250
256
TIMER_PRINT (" hashtable - total time for whole calculation" )
251
- printf (" %f million keys/second\n " , kNumKeyValues / (time_total / 1000 .0f ) / 1000000 .0f );
257
+ printf (" %f million keys/second\n " , kNumKeyValues / (time_total / ITERATIONS / 1000 .0f ) / 1000000 .0f );
252
258
253
259
bool verify = true ;
254
260
if (argc > 1 && strcmp (argv[1 ], " --no-verify" ) == 0 ) {
You can’t perform that action at this time.
0 commit comments