#include <string.h>
#include <stdlib.h>
#include "runtime_communication.h"
#include "controller_stats.h"
#include "timeseries.h"
#include "dfg.h"
#include "controller_dfg.h"
#include "jsmn.h"
#include "logging.h"
#include <unistd.h>
Go to the source code of this file.
|
#define | JSON_LEN_INCREMENT 1024 |
|
#define | CHECK_JSON_LEN(json, len) |
|
#define | START_JSON(json) (json).length = 0 |
|
#define | START_LIST(json) |
|
#define | END_LIST(json) |
|
#define | START_OBJ(json) |
|
#define | END_OBJ(json) |
|
#define | KEY_VAL(json, key, fmt, value, value_len) |
|
#define | KEY_INTVAL(json, key, value) KEY_VAL(json, key, "%d", value, 128) |
|
#define | KEY_STRVAL(json, key, value) KEY_VAL(json, key, "\"%s\"", value, strlen(value)) |
|
#define | FMT_KEY_VAL(json, key_fmt, key, key_len, val_fmt, value, value_len) |
|
#define | KEY(json, key) |
|
#define | VALUE(json, fmt, value, value_len) |
|
#define | END_JSON(json) (json).string[(json).length-1] = '\0' |
|
#define CHECK_JSON_LEN |
( |
|
json, |
|
|
|
len |
|
) |
| |
Value:while ( (
int)((json).allocated_size - (json).length) < (len)) {
\
}
#define log(level, fmt,...)
Log at a custom level.
#define JSON_LEN_INCREMENT
Definition at line 34 of file dfg_writer.c.
#define END_JSON |
( |
|
json | ) |
(json).string[(json).length-1] = '\0' |
Value:
(json).length += sprintf((json).string + (json).length - 1, "],") - 1; \
} while (0)
#define CHECK_JSON_LEN(json, len)
Definition at line 53 of file dfg_writer.c.
Value:
(json).length += sprintf((json).string + (json).length - 1 , "},") - 1; \
} while (0)
#define CHECK_JSON_LEN(json, len)
Definition at line 65 of file dfg_writer.c.
#define FMT_KEY_VAL |
( |
|
json, |
|
|
|
key_fmt, |
|
|
|
key, |
|
|
|
key_len, |
|
|
|
val_fmt, |
|
|
|
value, |
|
|
|
value_len |
|
) |
| |
Value:
(json).length += sprintf((json).string + (json).length, "\"" key_fmt "\":\"" val_fmt "\",", key, value); \
} while (0)
#define CHECK_JSON_LEN(json, len)
Definition at line 83 of file dfg_writer.c.
#define JSON_LEN_INCREMENT 1024 |
#define KEY |
( |
|
json, |
|
|
|
key |
|
) |
| |
Value:
(json).length += sprintf((json).string + (json).length, "\"" key "\":"); \
} while (0)
#define CHECK_JSON_LEN(json, len)
Definition at line 89 of file dfg_writer.c.
#define KEY_INTVAL |
( |
|
json, |
|
|
|
key, |
|
|
|
value |
|
) |
| KEY_VAL(json, key, "%d", value, 128) |
#define KEY_STRVAL |
( |
|
json, |
|
|
|
key, |
|
|
|
value |
|
) |
| KEY_VAL(json, key, "\"%s\"", value, strlen(value)) |
#define KEY_VAL |
( |
|
json, |
|
|
|
key, |
|
|
|
fmt, |
|
|
|
value, |
|
|
|
value_len |
|
) |
| |
Value:
(json).length += sprintf((json).string + (json).length, "\"" key "\":" fmt ",", value); \
} while (0)
#define CHECK_JSON_LEN(json, len)
Definition at line 71 of file dfg_writer.c.
#define START_JSON |
( |
|
json | ) |
(json).length = 0 |
#define START_LIST |
( |
|
json | ) |
|
Value:
(json).length += sprintf((json).string + (json).length, "[ "); \
} while (0)
#define CHECK_JSON_LEN(json, len)
Definition at line 44 of file dfg_writer.c.
#define START_OBJ |
( |
|
json | ) |
|
Value:
(json).length += sprintf((json).string + (json).length, "{ " ); \
} while (0)
#define CHECK_JSON_LEN(json, len)
Definition at line 59 of file dfg_writer.c.
#define VALUE |
( |
|
json, |
|
|
|
fmt, |
|
|
|
value, |
|
|
|
value_len |
|
) |
| |
Value:
(json).length += sprintf((json).string + (json).length, fmt ",", value); \
} while (0)
#define CHECK_JSON_LEN(json, len)
Definition at line 95 of file dfg_writer.c.
void dfg_to_file |
( |
char * |
filename | ) |
|
char* dfg_to_json |
( |
struct dedos_dfg * |
dfg, |
|
|
int |
n_stats |
|
) |
| |
static char* msu_stats_to_json |
( |
int |
msu_id, |
|
|
int |
n_stats |
|
) |
| |
|
static |
static char* msu_to_json |
( |
struct dfg_msu * |
msu, |
|
|
int |
n_stats |
|
) |
| |
|
static |
static char* route_to_json |
( |
struct dfg_route * |
route | ) |
|
|
static |
static char* runtime_to_json |
( |
struct dfg_runtime * |
rt | ) |
|
|
static |
static char* stat_to_json |
( |
struct timed_rrdb * |
timeseries, |
|
|
int |
n_stats |
|
) |
| |
|
static |
pthread_mutex_t json_lock |
|
static |