Files
fastfetch/tests/performance.c
T

69 lines
2.4 KiB
C
Raw Normal View History

2021-03-07 20:05:00 +01:00
#include "fastfetch.h"
#include <time.h>
#define FASTFETCH_TEST_PERFORMANCE(func) \
{ \
struct timespec start, end; \
clock_gettime(CLOCK_REALTIME, &start); \
func; \
clock_gettime(CLOCK_REALTIME, &end); \
long nanos = end.tv_nsec - start.tv_nsec; \
printf("\033[F"); \
for(uint8_t i = 0; i < 110; i++) printf("\033[C"); \
printf("%08ldns\n", nanos); \
} \
int main(int argc, char** argv)
{
2021-10-19 19:34:55 +02:00
FF_UNUSED(argc, argv);
2021-04-09 14:07:05 +02:00
2021-03-07 20:05:00 +01:00
FFinstance instance;
2021-03-27 18:14:19 +01:00
2021-03-07 20:05:00 +01:00
FASTFETCH_TEST_PERFORMANCE(
puts("Initialization");
2021-04-09 14:07:05 +02:00
ffInitInstance(&instance);
2021-03-07 20:05:00 +01:00
)
FASTFETCH_TEST_PERFORMANCE(
puts("Configuration");
2021-12-20 16:34:46 +01:00
ffStrbufSet(&instance.config.color, &instance.config.logoColors[0]);
2021-03-28 20:09:29 +02:00
instance.config.showErrors = true;
2021-04-15 18:59:26 +02:00
instance.config.recache = argc == 1;
2021-03-28 20:09:29 +02:00
instance.config.cacheSave = false;
2021-03-07 20:05:00 +01:00
)
2021-04-07 17:36:03 +02:00
FASTFETCH_TEST_PERFORMANCE(
puts("Thread starting");
ffStartDetectionThreads(&instance);
2021-04-07 17:36:03 +02:00
)
2021-03-07 20:05:00 +01:00
FASTFETCH_TEST_PERFORMANCE(ffPrintTitle(&instance))
2021-05-15 12:36:25 +02:00
FASTFETCH_TEST_PERFORMANCE(ffPrintSeparator(&instance))
2021-03-07 20:05:00 +01:00
FASTFETCH_TEST_PERFORMANCE(ffPrintOS(&instance))
FASTFETCH_TEST_PERFORMANCE(ffPrintHost(&instance))
FASTFETCH_TEST_PERFORMANCE(ffPrintKernel(&instance))
FASTFETCH_TEST_PERFORMANCE(ffPrintUptime(&instance))
FASTFETCH_TEST_PERFORMANCE(ffPrintPackages(&instance))
FASTFETCH_TEST_PERFORMANCE(ffPrintShell(&instance))
FASTFETCH_TEST_PERFORMANCE(ffPrintResolution(&instance))
FASTFETCH_TEST_PERFORMANCE(ffPrintDesktopEnvironment(&instance))
FASTFETCH_TEST_PERFORMANCE(ffPrintWM(&instance))
2021-04-03 23:10:14 +02:00
FASTFETCH_TEST_PERFORMANCE(ffPrintWMTheme(&instance))
2021-03-07 20:05:00 +01:00
FASTFETCH_TEST_PERFORMANCE(ffPrintTheme(&instance))
FASTFETCH_TEST_PERFORMANCE(ffPrintIcons(&instance))
FASTFETCH_TEST_PERFORMANCE(ffPrintFont(&instance))
FASTFETCH_TEST_PERFORMANCE(ffPrintTerminal(&instance))
2021-03-11 19:40:46 +01:00
FASTFETCH_TEST_PERFORMANCE(ffPrintTerminalFont(&instance))
2021-03-07 20:05:00 +01:00
FASTFETCH_TEST_PERFORMANCE(ffPrintCPU(&instance))
FASTFETCH_TEST_PERFORMANCE(ffPrintGPU(&instance))
FASTFETCH_TEST_PERFORMANCE(ffPrintMemory(&instance))
FASTFETCH_TEST_PERFORMANCE(ffPrintDisk(&instance))
FASTFETCH_TEST_PERFORMANCE(ffPrintBattery(&instance))
FASTFETCH_TEST_PERFORMANCE(ffPrintLocale(&instance))
FASTFETCH_TEST_PERFORMANCE(ffPrintBreak(&instance))
FASTFETCH_TEST_PERFORMANCE(ffPrintColors(&instance))
return 0;
2021-03-27 18:14:19 +01:00
}