ContainerTracer  0.1
Enumerations | Functions | Variables
tr-driver.c File Reference

Implementation of run the trace-replay benchmark. More...

#include <stdlib.h>
#include <errno.h>
#include <search.h>
#include <assert.h>
#include <unistd.h>
#include <signal.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/syscall.h>
#include <json.h>
#include <jemalloc/jemalloc.h>
#include <generic.h>
#include <runner.h>
#include <driver/tr-driver.h>
#include <log.h>
#include <sync.h>
#include <trace_replay.h>
Include dependency graph for tr-driver.c:

Enumerations

enum  { TR_NONE_SCHEDULER = 0, TR_KYBER_SCHEDULER, TR_BFQ_SCHEDULER }
 

Functions

static void tr_kill_handle (int signum)
 Capture the SIGTERM and deallocate all resources which this process has. More...
 
static void __tr_free (void)
 Deallocate this driver's resources. More...
 
int tr_valid_scheduler_test (const char *scheduler)
 Check the current inputted scheduler text can be supported by the driver. More...
 
int tr_has_weight_scheduler (const int scheduler_index)
 Check the parameter's scheduler_index supports weight. More...
 
int tr_init (void *object)
 Initialize the global configuration and per processes configuration. More...
 
static int tr_set_cgroup_state (struct tr_info *current)
 Set the child process to specific control group(cgroup) More...
 
static int tr_do_exec (struct tr_info *current)
 Each process trace-replay execute part. More...
 
int tr_runner (void)
 Run all processes' trace-replay part. More...
 
int tr_get_interval (const char *key, char *buffer)
 Get execution-time results from trace-replay. More...
 
int tr_get_total (const char *key, char *buffer)
 Get end-time results from trace-replay. More...
 
void tr_free (void)
 Deallocate resources of this driver. More...
 

Variables

static const char * tr_valid_scheduler []
 Associated table of I/O scheduler. More...
 
static const int tr_weight_support_scheduler [] = { TR_BFQ_SCHEDULER }
 
static struct tr_infoglobal_info_head = NULL
 

Detailed Description

Implementation of run the trace-replay benchmark.

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.2
Date
2020-08-05

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
TR_NONE_SCHEDULER 
TR_KYBER_SCHEDULER 
TR_BFQ_SCHEDULER 

Function Documentation

◆ __tr_free()

static void __tr_free ( void  )
static

Deallocate this driver's resources.

Note
http://www.ascii-art.de/ascii/def/dr_who.txt
Here is the call graph for this function:

◆ tr_do_exec()

static int tr_do_exec ( struct tr_info current)
static

Each process trace-replay execute part.

Parameters
[in]currentThe structure which has the current process information.
Returns
0 for success to execute, negative value for fail to create.
Here is the call graph for this function:

◆ tr_free()

void tr_free ( void  )

Deallocate resources of this driver.

Here is the call graph for this function:

◆ tr_get_interval()

int tr_get_interval ( const char *  key,
char *  buffer 
)

Get execution-time results from trace-replay.

Parameters
[in]keycgroup_id value which specifies the location of data I want to get.
[out]bufferData contains the execution-time results based on key.
Returns
log.type for success to get information, negative value for fail to get information.
Warning
buffer must be allocated memory over and equal INTERVAL_RESULT_STRING_SIZE
Here is the call graph for this function:

◆ tr_get_total()

int tr_get_total ( const char *  key,
char *  buffer 
)

Get end-time results from trace-replay.

Parameters
[in]keycgroup_id value which specifies the location of data I want to get.
[out]bufferData contains the end-time results based on key.
Returns
0 for success to get information, negative value for fail to get information.
Warning
buffer must be allocated memory over and equal TOTAL_RESULT_STRING_SIZE
Here is the call graph for this function:

◆ tr_has_weight_scheduler()

int tr_has_weight_scheduler ( const int  scheduler_index)

Check the parameter's scheduler_index supports weight.

Parameters
[in]scheduler_indexThe scheduler's index which is based on tr_valid_scheduler and wants to check.
Returns
0 for doesn't support the weight, 1 for supporting the weight

◆ tr_init()

int tr_init ( void *  object)

Initialize the global configuration and per processes configuration.

Parameters
[in]objectglobal runner_config pointer.
Returns
0 for success to init, error number for fail to init.
Warning
Do not run this function in child process.
Here is the call graph for this function:

◆ tr_kill_handle()

static void tr_kill_handle ( int  signum)
static

Capture the SIGTERM and deallocate all resources which this process has.

Parameters
[in]signumCurrent captured signal.
Note
SIGKILL isn't captured.
Here is the call graph for this function:

◆ tr_runner()

int tr_runner ( void  )

Run all processes' trace-replay part.

Returns
0 for success to run, error number for fail to run.
Here is the call graph for this function:

◆ tr_set_cgroup_state()

static int tr_set_cgroup_state ( struct tr_info current)
static

Set the child process to specific control group(cgroup)

Parameters
[in]currentThe structure which has the current process information.
Returns
0 for success to set, errno for fail to set.
Here is the call graph for this function:

◆ tr_valid_scheduler_test()

int tr_valid_scheduler_test ( const char *  scheduler)

Check the current inputted scheduler text can be supported by the driver.

Parameters
[in]schedulerInputted scheduler string.
Returns
0 and positive integer for mean support the scheduler, -EINVAL for mean don't support the scheduler.

Variable Documentation

◆ global_info_head

struct tr_info* global_info_head = NULL
static

global tr_info list

◆ tr_valid_scheduler

const char* tr_valid_scheduler[]
static
Initial value:
= {
[TR_NONE_SCHEDULER] = "none",
[TR_KYBER_SCHEDULER] = "kyber",
[TR_BFQ_SCHEDULER] = "bfq",
NULL,
}
Definition: tr-driver.c:49
Definition: tr-driver.c:47
Definition: tr-driver.c:48

Associated table of I/O scheduler.

Warning
Kyber sceduler doesn't support in SCSI devices.

◆ tr_weight_support_scheduler

const int tr_weight_support_scheduler[] = { TR_BFQ_SCHEDULER }
static