ContainerTracer  0.1
Functions | Variables
runner.c File Reference

Definition of runner.h declaration contents. More...

#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <unistd.h>
#include <linux/limits.h>
#include <jemalloc/jemalloc.h>
#include <json.h>
#include <generic.h>
#include <runner.h>
#include <log.h>
Include dependency graph for runner.c:

Functions

void runner_config_free (struct runner_config *config, const int flags)
 Deallocate the global_runner's contents. More...
 
int runner_init (const char *json_str)
 Read the JSON string and config the runner. More...
 
int runner_run (void)
 Execute the benchmark program. More...
 
void runner_free (void)
 Wrapping function of __runner_free(). More...
 
static int runner_get_result_string (char **buffer, size_t size)
 Generate the buffer which contains the result. More...
 
void runner_put_result_string (char *buffer)
 Deallocate the buffer which is allocated by runner_get_result_string() function. More...
 
char * runner_get_interval_result (const char *key)
 Get a specific driver's execution-time results. More...
 
char * runner_get_total_result (const char *key)
 Get a specific driver's end-time results. More...
 
const struct runner_configrunner_get_global_config (void)
 Get a global configuration pointer. More...
 

Variables

static struct runner_configglobal_config
 

Detailed Description

Definition of runner.h declaration contents.

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.1
Date
2020-08-04

Function Documentation

◆ runner_config_free()

void runner_config_free ( struct runner_config config,
const int  flags 
)

Deallocate the global_runner's contents.

Parameters
[in]configpointer of runner_config structure.
[in]flagsFlag of deallocation range.

◆ runner_free()

void runner_free ( void  )

Wrapping function of __runner_free().

Here is the call graph for this function:

◆ runner_get_global_config()

const struct runner_config* runner_get_global_config ( void  )

Get a global configuration pointer.

Returns
global_config pointer.
Note
You must use only on debugging or restricted environments.

◆ runner_get_interval_result()

char* runner_get_interval_result ( const char *  key)

Get a specific driver's execution-time results.

Parameters
[in]keyThe key which specifies target to get execution-time result.
Returns
Return JSON string which contains the execution-time results. However, if allocates fail then returns NULL.
Warning
Due to the buffer was allocated by runner_get_result_string(), you must deallocate this buffer by using runner_put_result_string().
Here is the call graph for this function:

◆ runner_get_result_string()

static int runner_get_result_string ( char **  buffer,
size_t  size 
)
static

Generate the buffer which contains the result.

Parameters
[out]bufferDestination buffer which wants to allocate the memory.
[in]sizeBuffer's size.
Returns
0 for buffer allocation success, -EINVAL for buffer allocation fail.

◆ runner_get_total_result()

char* runner_get_total_result ( const char *  key)

Get a specific driver's end-time results.

Parameters
[in]keyThe key which specifies target to get end-time result.
Returns
Return JSON string which contains the end-time results. However, if allocates fail then returns NULL.
Warning
Due to the buffer was allocated by runner_get_result_string(), you must deallocate this buffer by using runner_put_result_string().
Here is the call graph for this function:

◆ runner_init()

int runner_init ( const char *  json_str)

Read the JSON string and config the runner.

Parameters
[in]json_strJSON string which is used in runner config.
Returns
0 for success to init, error number for fail to init.
Exceptions
Errornumber returns if there exists any invalid value in JSON string.
Here is the call graph for this function:

◆ runner_put_result_string()

void runner_put_result_string ( char *  buffer)

Deallocate the buffer which is allocated by runner_get_result_string() function.

Parameters
[in]bufferA dynamically allocated buffer which wants to deallocate.

◆ runner_run()

int runner_run ( void  )

Execute the benchmark program.

Returns
Driver's execution result.

Variable Documentation

◆ global_config

struct runner_config* global_config
static
Initial value:
=
NULL

Global configuration contents of runner