Global: improve support of --help *-format

Also fix some bugs found when refactoring
This commit is contained in:
李通洲
2023-10-07 13:40:40 +08:00
parent 23d2cc3fdc
commit 12208b2c7c
113 changed files with 746 additions and 557 deletions
+22 -2
View File
@@ -10,7 +10,7 @@
#include <stdlib.h>
#define FF_GPU_NUM_FORMAT_ARGS 6
#define FF_GPU_NUM_FORMAT_ARGS 10
static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResult* gpu)
{
@@ -77,6 +77,10 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu
{FF_FORMAT_ARG_TYPE_DOUBLE, &gpu->temperature},
{FF_FORMAT_ARG_TYPE_INT, &gpu->coreCount},
{FF_FORMAT_ARG_TYPE_STRING, type},
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->dedicated.total},
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->dedicated.used},
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->shared.total},
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->shared.used},
});
}
}
@@ -121,7 +125,7 @@ void ffPrintGPU(FFGPUOptions* options)
void ffInitGPUOptions(FFGPUOptions* options)
{
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_GPU_MODULE_NAME, ffParseGPUCommandOptions, ffParseGPUJsonObject, ffPrintGPU, ffGenerateGPUJson);
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_GPU_MODULE_NAME, ffParseGPUCommandOptions, ffParseGPUJsonObject, ffPrintGPU, ffGenerateGPUJson, ffPrintGPUHelpFormat);
ffOptionInitModuleArg(&options->moduleArgs);
options->forceVulkan = false;
@@ -277,3 +281,19 @@ void ffGenerateGPUJson(FFGPUOptions* options, yyjson_mut_doc* doc, yyjson_mut_va
ffStrbufDestroy(&gpu->driver);
}
}
void ffPrintGPUHelpFormat(void)
{
ffPrintModuleFormatHelp(FF_GPU_MODULE_NAME, "{1} {2}", FF_GPU_NUM_FORMAT_ARGS, (const char* []) {
"GPU vendor",
"GPU name",
"GPU driver",
"GPU temperature",
"GPU core count",
"GPU type",
"GPU total dedicated memory",
"GPU used dedicated memory",
"GPU total shared memory",
"GPU used shared memory",
});
}