66#include "modules/cpu/cpu.h"
77#include "util/stringUtils.h"
88
9- #define FF_CPU_NUM_FORMAT_ARGS 9
9+ #define FF_CPU_NUM_FORMAT_ARGS 10
1010
1111static int sortCores (const FFCPUCore * a , const FFCPUCore * b )
1212{
@@ -55,8 +55,8 @@ void ffPrintCPU(FFCPUOptions* options)
5555
5656 FF_STRBUF_AUTO_DESTROY str = ffStrbufCreate ();
5757
58- if (cpu .cpuCount > 1 )
59- ffStrbufAppendF (& str , "%u x " , cpu .cpuCount );
58+ if (cpu .packages > 1 )
59+ ffStrbufAppendF (& str , "%u x " , cpu .packages );
6060
6161 if (cpu .name .length > 0 )
6262 ffStrbufAppend (& str , & cpu .name );
@@ -72,7 +72,7 @@ void ffPrintCPU(FFCPUOptions* options)
7272 ffStrbufAppendF (& str , " (%s)" , coreTypes .chars );
7373 else if (cpu .coresOnline > 1 )
7474 {
75- if (cpu .cpuCount > 1 )
75+ if (cpu .packages > 1 )
7676 ffStrbufAppendF (& str , " (%u)" , cpu .coresOnline / 2 );
7777 else
7878 ffStrbufAppendF (& str , " (%u)" , cpu .coresOnline );
@@ -114,6 +114,7 @@ void ffPrintCPU(FFCPUOptions* options)
114114 FF_FORMAT_ARG (freqMax , "freq-max" ),
115115 FF_FORMAT_ARG (tempStr , "temperature" ),
116116 FF_FORMAT_ARG (coreTypes , "core-types" ),
117+ FF_FORMAT_ARG (cpu .packages , "packages" ),
117118 }));
118119 }
119120 }
@@ -211,6 +212,10 @@ void ffGenerateCPUJsonResult(FFCPUOptions* options, yyjson_mut_doc* doc, yyjson_
211212 yyjson_mut_val * obj = yyjson_mut_obj_add_obj (doc , module , "result" );
212213 yyjson_mut_obj_add_strbuf (doc , obj , "cpu" , & cpu .name );
213214 yyjson_mut_obj_add_strbuf (doc , obj , "vendor" , & cpu .vendor );
215+ if (cpu .packages == 0 )
216+ yyjson_mut_obj_add_null (doc , obj , "packages" );
217+ else
218+ yyjson_mut_obj_add_uint (doc , obj , "packages" , cpu .packages );
214219
215220 yyjson_mut_val * cores = yyjson_mut_obj_add_obj (doc , obj , "cores" );
216221 yyjson_mut_obj_add_uint (doc , cores , "physical" , cpu .coresPhysical );
@@ -248,6 +253,7 @@ void ffPrintCPUHelpFormat(void)
248253 "Max frequency (formatted) - freq-max" ,
249254 "Temperature (formatted) - temperature" ,
250255 "Logical core count grouped by frequency - core-types" ,
256+ "Processor package count - packages" ,
251257 }));
252258}
253259
0 commit comments