utils.h

Overview

This header file declares utility functions primarily focused on time measurement, JSON data handling, and output assistance within the application. It provides platform-independent time retrieval, comparison of JSON strings, and reading JSON test data from files. The file also defines a macro to facilitate JSON token iteration, streamlining JSON parsing operations.

Detailed Descriptions

Preprocessor Directives and Includes

Functions

long long utils_get_time(void);


void utils_print_time_diff(long long start_ns, long long end_ns);


char *utils_get_test_json_data(const char *filename);


bool utils_test_json_equal(const char *a, const char *b);


void utils_output(const char *s);


Macro

NEXT_TOKEN(s)


Interaction with Other System Components


Visual Diagram of utils.h Structure

flowchart TD
A[utils_get_time] --> B[utils_print_time_diff]
A --> C[utils_get_test_json_data]
C --> D[utils_test_json_equal]
D --> E[utils_output]
F[NEXT_TOKEN macro] -->|calls| G[json_next_token]
style A fill:#f9f,stroke:#333,stroke-width:1px
style B fill:#ccf,stroke:#333,stroke-width:1px
style C fill:#cfc,stroke:#333,stroke-width:1px
style D fill:#fcf,stroke:#333,stroke-width:1px
style E fill:#cff,stroke:#333,stroke-width:1px
style F fill:#ffc,stroke:#333,stroke-width:1px
style G fill:#eee,stroke:#333,stroke-width:1px

This flowchart illustrates the main functions and their relationships, showing how the JSON token macro depends on the external json_next_token function and how time-related functions relate to each other.