#include <sys/types.h>
#include <sys/time.h>
Go to the source code of this file.
| #define | alloc_nr(x) (((x)+16)*3/2) |
| Macro for dynamically increasing vector lengths. | |
| int | real_online_cpus (void) |
| Get number of online cpus. | |
| int | online_cpus (void) |
| Wrapper for real_online_cpus(), returning 1 in case we can't detect any active cpus. | |
| const char * | mkstr (const char *fmt,...) __attribute__((__format__(__printf__ |
| Create a short-lived string in stack-allocated memory The number and size of strings is limited (currently to 256 strings of 32 bytes each), so beware and use this sensibly. | |
| const char int | tv_delta_msec (const struct timeval *start, const struct timeval *stop) |
| Calculate the millisecond delta between two timeval structs. | |
| float | tv_delta_f (const struct timeval *start, const struct timeval *stop) |
| Get timeval delta as seconds. |
This is where we house all helpers and macros that fall outside the "standard-ish" norm. The prefixes "nsu_" and NSU_ are reserved for this purpose, so we avoid clashing with other applications that may have similarly-acting functions with identical names.
The functions already here lack the nsu_ prefix for backwards compatibility reasons. It's possible we'll have to fix that some day, but let's leave that for later.
| const char* mkstr | ( | const char * | fmt, | |
| ... | ||||
| ) |
Create a short-lived string in stack-allocated memory The number and size of strings is limited (currently to 256 strings of 32 bytes each), so beware and use this sensibly.
Intended for number-to-string conversion and other short strings.
| [in] | fmt | The format string |
| int online_cpus | ( | void | ) |
Wrapper for real_online_cpus(), returning 1 in case we can't detect any active cpus.
| int real_online_cpus | ( | void | ) |
Get number of online cpus.
| float tv_delta_f | ( | const struct timeval * | start, | |
| const struct timeval * | stop | |||
| ) |
Get timeval delta as seconds.
| start | The start time | |
| stop | The stop time |
| const char int tv_delta_msec | ( | const struct timeval * | start, | |
| const struct timeval * | stop | |||
| ) |
Calculate the millisecond delta between two timeval structs.
| [in] | start | The start time |
| [in] | stop | The stop time |
1.5.6