66#include "util/stringUtils.h"
77
88#define FF_NETUSAGE_DISPLAY_NAME "Net Usage"
9- #define FF_NETUSAGE_NUM_FORMAT_ARGS 1
9+ #define FF_NETUSAGE_NUM_FORMAT_ARGS 12
1010
1111static int sortInfs (const FFNetUsageIoCounters * left , const FFNetUsageIoCounters * right )
1212{
@@ -71,11 +71,15 @@ void ffPrintNetUsage(FFNetUsageOptions* options)
7171 {
7272 ffStrbufClear (& buffer2 );
7373 ffParseSize (inf -> rxBytes , & buffer );
74+ ffStrbufAppendS (& buffer , "/s" );
7475 ffParseSize (inf -> txBytes , & buffer2 );
76+ ffStrbufAppendS (& buffer2 , "/s" );
77+
7578 ffPrintFormatString (key .chars , 0 , & options -> moduleArgs , FF_PRINT_TYPE_NO_CUSTOM_KEY , FF_NETUSAGE_NUM_FORMAT_ARGS , (FFformatarg []){
76- {FF_FORMAT_ARG_TYPE_STRBUF , & inf -> name },
7779 {FF_FORMAT_ARG_TYPE_STRBUF , & buffer },
7880 {FF_FORMAT_ARG_TYPE_STRBUF , & buffer2 },
81+ {FF_FORMAT_ARG_TYPE_STRBUF , & inf -> name },
82+ {FF_FORMAT_ARG_TYPE_BOOL , & inf -> defaultRoute },
7983 {FF_FORMAT_ARG_TYPE_UINT64 , & inf -> txBytes },
8084 {FF_FORMAT_ARG_TYPE_UINT64 , & inf -> rxBytes },
8185 {FF_FORMAT_ARG_TYPE_UINT64 , & inf -> txPackets },
@@ -84,7 +88,6 @@ void ffPrintNetUsage(FFNetUsageOptions* options)
8488 {FF_FORMAT_ARG_TYPE_UINT64 , & inf -> txErrors },
8589 {FF_FORMAT_ARG_TYPE_UINT64 , & inf -> rxDrops },
8690 {FF_FORMAT_ARG_TYPE_UINT64 , & inf -> txDrops },
87- {FF_FORMAT_ARG_TYPE_BOOL , & inf -> defaultRoute },
8891 });
8992 }
9093 ++ index ;
@@ -178,6 +181,7 @@ void ffGenerateNetUsageJson(FFNetUsageOptions* options, yyjson_mut_doc* doc, yyj
178181 {
179182 yyjson_mut_val * obj = yyjson_mut_arr_add_obj (doc , arr );
180183 yyjson_mut_obj_add_strbuf (doc , obj , "name" , & counter -> name );
184+ yyjson_mut_obj_add_bool (doc , obj , "defaultRoute" , counter -> defaultRoute );
181185 yyjson_mut_obj_add_uint (doc , obj , "txBytes" , counter -> txBytes );
182186 yyjson_mut_obj_add_uint (doc , obj , "rxBytes" , counter -> rxBytes );
183187 yyjson_mut_obj_add_uint (doc , obj , "txPackets" , counter -> txPackets );
@@ -186,7 +190,6 @@ void ffGenerateNetUsageJson(FFNetUsageOptions* options, yyjson_mut_doc* doc, yyj
186190 yyjson_mut_obj_add_uint (doc , obj , "txErrors" , counter -> txErrors );
187191 yyjson_mut_obj_add_uint (doc , obj , "rxDrops" , counter -> rxDrops );
188192 yyjson_mut_obj_add_uint (doc , obj , "txDrops" , counter -> txDrops );
189- yyjson_mut_obj_add_bool (doc , obj , "defaultRoute" , counter -> defaultRoute );
190193 }
191194
192195 FF_LIST_FOR_EACH (FFNetUsageIoCounters , inf , result )
0 commit comments