@@ -662,16 +662,17 @@ int run_main_thread(struct options *opts, struct callbacks *cb,
662662 control_plane_destroy (cp );
663663
664664 if (opts -> rx_zerocopy ) {
665- uint64_t total_rx_zc_bytes = 0 ;
666- uint64_t total_rx_bytes = 0 ;
667- uint64_t percent_mmaped ;
665+ uint64_t total_zc_bytes = 0 ;
666+ uint64_t total_bytes = 0 ;
667+ uint64_t percent_mmaped = 0 ;
668668
669669 for (int i = 0 ; i < opts -> num_threads ; i ++ ) {
670- total_rx_zc_bytes += ts [i ].io_stats .rx_zc_bytes ;
671- total_rx_bytes += ts [i ].io_stats .rx_bytes ;
670+ total_zc_bytes += ts [i ].io_stats .rx_zc_bytes ;
671+ total_bytes += ts [i ].io_stats .rx_bytes ;
672672 }
673- percent_mmaped = 100 * total_rx_zc_bytes / total_rx_bytes ;
674- PRINT (cb , "bytes_mmaped" , "%lu" , total_rx_zc_bytes );
673+ if (total_zc_bytes > 0 )
674+ percent_mmaped = 100 * total_zc_bytes / total_bytes ;
675+ PRINT (cb , "bytes_mmaped" , "%lu" , total_zc_bytes );
675676 PRINT (cb , "percent_mmaped" , "%lu" , percent_mmaped );
676677 if (percent_mmaped < 10 ) {
677678 LOG_WARN (cb , "Little traffic is being handled by "
0 commit comments