ContainerTracer  0.1
Functions
tr-serializer.c File Reference

To make structure to JSON format. More...

#include <stdlib.h>
#include <assert.h>
#include <json.h>
#include <jemalloc/jemalloc.h>
#include <driver/tr-driver.h>
#include <runner.h>
Include dependency graph for tr-serializer.c:

Functions

static struct json_object * tr_info_serializer (const struct tr_info *info)
 To make a tr_info structure to json_object. More...
 
static struct json_object * tr_realtime_log_serializer (const struct realtime_log *log)
 To make a realtime_log structure to json_object. More...
 
static struct json_object * tr_total_trace_serializer (const struct trace *traces)
 To make a trace structure to json_object. More...
 
static struct json_object * tr_total_config_serializer (const struct total_results *total, struct tr_total_json_object *jobject)
 To make a total_results structure's config member to json_object. More...
 
static struct json_object * tr_synthetic_serializer (const struct synthetic *_synthetic)
 To make a synthetic structure to json_object. More...
 
static struct json_object * tr_stats_serializer (const struct trace_stat *_stats)
 To make a trace_stat structure to json_object. More...
 
static struct json_object * tr_total_per_trace_serializer (const struct total_results *total, struct tr_total_json_object *jobject)
 To make a total_results structure's per_trace member to json_object. More...
 
static struct json_object * tr_total_aggr_serializer (const struct total_results *total)
 To make a aggr_result structure's per_trace member to json_object. More...
 
static struct json_object * tr_total_result_serializer (const struct total_results *total, struct tr_total_json_object *jobject)
 to make a total_results structure's per_trace and aggr_result member to json_object. More...
 
static struct json_object * tr_total_results_serializer (const struct total_results *total, struct tr_total_json_object *jobject)
 to make a total_results structure's all member to json_object. More...
 
void tr_realtime_serializer (const struct tr_info *info, const struct realtime_log *log, char *buffer)
 Converts realtime_log to JSON string. More...
 
void tr_total_serializer (const struct tr_info *info, const struct total_results *total, char *buffer)
 Converts total_results to JSON string. More...
 

Detailed Description

To make structure to JSON format.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Author
BlaCkinkGJ (ss5ki.nosp@m.jun@.nosp@m.gmail.nosp@m..com)
Version
0.1
Date
2020-08-10

Function Documentation

◆ tr_info_serializer()

static struct json_object* tr_info_serializer ( const struct tr_info info)
static

To make a tr_info structure to json_object.

Parameters
[in]infotr_info data structure which wants to convert json_object
Returns
Structure's json_object
Note
You must deallocate this returned json_object or attach this to the other json_object.

◆ tr_realtime_log_serializer()

static struct json_object* tr_realtime_log_serializer ( const struct realtime_log log)
static

To make a realtime_log structure to json_object.

Parameters
[in]logrealtime_log data structure which wants to convert json_object.
Returns
Structure's json_object
Note
You must deallocate this returned json_object or attach this to the other json_object.

◆ tr_realtime_serializer()

void tr_realtime_serializer ( const struct tr_info info,
const struct realtime_log log,
char *  buffer 
)

Converts realtime_log to JSON string.

Parameters
[in]infotr_info structure's pointer.
[in]logrealtime_log structure's pointer.
[out]bufferData contains the execution-time results which are converted to JSON.
Warning
buffer must be allocated memory over and equal INTERVAL_RESULT_STRING_SIZE
Here is the call graph for this function:

◆ tr_stats_serializer()

static struct json_object* tr_stats_serializer ( const struct trace_stat _stats)
static

To make a trace_stat structure to json_object.

Parameters
[in]_statstrace_stat data structure which wants to convert json_object.
Returns
Structure's json_object
Note
You must deallocate this returned json_object or attach this to the other json_object.

◆ tr_synthetic_serializer()

static struct json_object* tr_synthetic_serializer ( const struct synthetic _synthetic)
static

To make a synthetic structure to json_object.

Parameters
[in]_syntheticsynthetic data structure which wants to convert json_object.
Returns
Structure's json_object
Note
You must deallocate this returned json_object or attach this to the other json_object.

◆ tr_total_aggr_serializer()

static struct json_object* tr_total_aggr_serializer ( const struct total_results total)
static

To make a aggr_result structure's per_trace member to json_object.

Parameters
[in]totaltotal_results data structure which wants to convert aggr_result member to json_object.
Returns
total_results structure's aggr_result member's json_object. This is same form of stats.
Note
You must deallocate this returned json_object or attach this to the other json_object.
Here is the call graph for this function:

◆ tr_total_config_serializer()

static struct json_object* tr_total_config_serializer ( const struct total_results total,
struct tr_total_json_object jobject 
)
static

To make a total_results structure's config member to json_object.

Parameters
[in]totaltotal_results data structure which wants to convert config member to json_object.
[in]jobjectAddress of tr_total_json_object which already occupying the memory.
Returns
total_results structure's config member's json_object
Note
You must deallocate this returned json_object or attach this to the other json_object.
Here is the call graph for this function:

◆ tr_total_per_trace_serializer()

static struct json_object* tr_total_per_trace_serializer ( const struct total_results total,
struct tr_total_json_object jobject 
)
static

To make a total_results structure's per_trace member to json_object.

Parameters
[in]totaltotal_results data structure which wants to convert per_trace member to json_object.
[in]jobjectAddress of tr_total_json_object which already occupying the memory.
Returns
total_results structure's per_trace member's json_object
Note
You must deallocate this returned json_object or attach this to the other json_object.
Here is the call graph for this function:

◆ tr_total_result_serializer()

static struct json_object* tr_total_result_serializer ( const struct total_results total,
struct tr_total_json_object jobject 
)
static

to make a total_results structure's per_trace and aggr_result member to json_object.

Parameters
[in]totaltotal_results data structure which wants to convert per_trace and aggr_result member to json_object.
[in]jobjectaddress of tr_total_json_object which already occupying the memory.
Returns
total_results structure's per_trace and aggr_result member's json_object
Note
you must deallocate this returned json_object or attach this to the other json_object.
Here is the call graph for this function:

◆ tr_total_results_serializer()

static struct json_object* tr_total_results_serializer ( const struct total_results total,
struct tr_total_json_object jobject 
)
static

to make a total_results structure's all member to json_object.

Parameters
[in]totaltotal_results data structure which wants to convert all member to json_object.
[in]jobjectaddress of tr_total_json_object which already occupying the memory.
Returns
total_results structure's all member's json_object
Note
you must deallocate this returned json_object or attach this to the other json_object.
Here is the call graph for this function:

◆ tr_total_serializer()

void tr_total_serializer ( const struct tr_info info,
const struct total_results total,
char *  buffer 
)

Converts total_results to JSON string.

Parameters
[in]infotr_info structure's pointer.
[in]totaltotal_results structure's pointer.
[out]bufferData contains the end-time results which are converted to JSON.
Warning
buffer must be allocated memory over and equal TOTAL_RESULT_STRING_SIZE
Here is the call graph for this function:

◆ tr_total_trace_serializer()

static struct json_object* tr_total_trace_serializer ( const struct trace traces)
static

To make a trace structure to json_object.

Parameters
[in]tracestrace data structure which wants to convert json_object.
Returns
Structure's json_object
Note
You must deallocate this returned json_object or attach this to the other json_object.