Top: adds option showType: <cpu|mem|disk>

This commit is contained in:
李通洲
2026-08-25 20:08:06 +08:00
parent b7d8c12015
commit 4344aa2ff1
17 changed files with 349 additions and 204 deletions
+5 -2
View File
@@ -114,8 +114,11 @@ void ffPrepareCommandOption(FFdata* data) {
#if !FF_MODULE_DISABLE_TOP
case 'T':
case 't':
FF_IF_MODULE_MATCH(ffTopModuleInfo.name)
ffPrepareTopProcesses();
FF_IF_MODULE_MATCH(ffTopModuleInfo.name) {
[[gnu::cleanup(ffDestroyTopOptions)]] FFTopOptions options;
ffInitTopOptions(&options);
ffPrepareTopProcesses(options.showTypes);
}
break;
#endif
+6 -1
View File
@@ -199,7 +199,12 @@ static void prepareModuleJsonObject(const char* type, yyjson_val* module) {
case 't':
case 'T': {
if (ffStrEqualsIgnCase(type, ffTopModuleInfo.name)) {
ffPrepareTopProcesses();
[[gnu::cleanup(ffDestroyTopOptions)]] FFTopOptions options;
ffInitTopOptions(&options);
if (module) {
ffTopModuleInfo.parseJsonObject(&options, module);
}
ffPrepareTopProcesses(options.showTypes);
}
break;
}