@@ -102,6 +102,8 @@ uint16_t flag_fanout_type =
102102#else
103103 PACKET_FANOUT_LB;
104104#endif
105+
106+ int64_t blocks_per_file = (flag_filesize_mb * 1024 ) / flag_blocksize_kb;
105107uint16_t flag_fanout_id = 0 ;
106108std::string flag_uid;
107109std::string flag_gid;
@@ -138,6 +140,7 @@ int ParseOptions(int key, char* arg, struct argp_state* state) {
138140 break ;
139141 case 305 :
140142 flag_filesize_mb = atoi (arg);
143+ blocks_per_file = (flag_filesize_mb * 1024 ) / flag_blocksize_kb;
141144 break ;
142145 case 306 :
143146 flag_threads = atoi (arg);
@@ -183,6 +186,7 @@ int ParseOptions(int key, char* arg, struct argp_state* state) {
183186 break ;
184187 case 320 :
185188 flag_blocksize_kb = atoll (arg);
189+ blocks_per_file = (flag_filesize_mb * 1024 ) / flag_blocksize_kb;
186190 break ;
187191 case 321 :
188192 flag_promisc = false ;
@@ -478,7 +482,7 @@ void RunThread(int thread, st::ProducerConsumerQueue* write_index,
478482 // Rotate file if necessary.
479483 int64_t current_file_age_secs =
480484 (current_micros - micros) / kNumMicrosPerSecond ;
481- if (block_offset == flag_filesize_mb ||
485+ if (block_offset == blocks_per_file ||
482486 current_file_age_secs > flag_fileage_sec) {
483487 VLOG (1 ) << " Rotating file " << micros << " with " << block_offset
484488 << " blocks" ;
@@ -508,16 +512,17 @@ void RunThread(int thread, st::ProducerConsumerQueue* write_index,
508512 blocks++;
509513 block_offset++;
510514
511- // Log stats every 100MB or at least 1/minute.
515+ // Log stats every 100 blocks or at least 1/minute.
512516 if (blocks % 100 == 0 ||
513517 lastlog < current_micros - 60 * kNumMicrosPerSecond ) {
514518 lastlog = current_micros;
515519 double duration = (current_micros - start) * 1.0 / kNumMicrosPerSecond ;
516520 Stats stats;
517521 Error stats_err = v3->GetStats (&stats);
518522 if (SUCCEEDED (stats_err)) {
519- LOG (INFO) << " Thread " << thread << " stats: MB=" << blocks
520- << " secs=" << duration << " MBps=" << (blocks / duration)
523+ uint64_t mb = (blocks * flag_blocksize_kb) / 1024 ;
524+ LOG (INFO) << " Thread " << thread << " stats: MB=" << mb
525+ << " secs=" << duration << " MBps=" << (mb / duration)
521526 << " " << stats.String ();
522527 } else {
523528 LOG (ERROR) << " Unable to get stats: " << *stats_err;
0 commit comments