ContainerTracer
0.1
|
driver declaration part of run trace-replay
More...
#include <linux/limits.h>
#include <unistd.h>
#include <sys/types.h>
#include <json.h>
#include <generic.h>
#include <trace_replay.h>
Go to the source code of this file.
Data Structures | |
struct | tr_json_field |
Support structure of the tr_stats_serializer() function. More... | |
struct | tr_total_json_object |
Support structure of the total_results structures which located in include/trace_replay.h . More... | |
struct | tr_info |
This structure has the major information of the each process. More... | |
Macros | |
#define | tr_info_list_traverse(ptr, head) for (ptr = head; ptr != NULL; ptr = ptr->next) |
Traverse the tr_info structures. More... | |
#define | tr_json_field_traverse(ptr, begin, end) for (ptr = begin; ptr != end; ptr++) |
Traverse the tr_json_field structures. More... | |
#define | TR_CGROUP_PREFIX "/sys/fs/cgroup/blkio/" |
#define | TR_CGROUP_WEIGHT_PREFIX "blkio" |
#define | TR_CGROUP_SET_PID "tasks" |
Enumerations | |
enum | { TR_IPC_NOT_FREE = 0x0, TR_IPC_FREE = 0x1 } |
enum | { TR_NOT_SYNTH = 0, TR_SYNTH = 0x1 } |
enum | { TR_ERROR_PRINT, TR_PRINT_NONE } |
Functions | |
int | tr_init (void *object) |
Initialize the global configuration and per processes configuration. More... | |
int | tr_runner (void) |
Run all processes' trace-replay part. 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_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... | |
void | tr_total_serializer (const struct tr_info *info, const struct total_results *total, char *buffer) |
Converts total_results to JSON string. More... | |
void | tr_realtime_serializer (const struct tr_info *info, const struct realtime_log *log, char *buffer) |
Converts realtime_log to JSON string. More... | |
struct tr_info * | tr_info_init (struct json_object *setting, int index) |
Generate and construct the per processes info object and return it. More... | |
int | tr_shm_init (struct tr_info *info) |
Do the __tr_shm_init() and __tr_sem_init() More... | |
int | tr_shm_get (const struct tr_info *info, void *buffer) |
Retrieve the data from Shared Memory. More... | |
void | tr_shm_free (struct tr_info *info, int flags) |
Deallocate the Shared Memory resources. More... | |
int | tr_mq_init (struct tr_info *info) |
Wrapping function of __tr_mq_init() More... | |
int | tr_mq_get (const struct tr_info *info, void *buffer) |
Retrieve the data from Message Queue. More... | |
void | tr_mq_free (struct tr_info *info, int flags) |
Deallocate the Message Queue resources. More... | |
driver declaration part of run trace-replay
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.
#define TR_CGROUP_PREFIX "/sys/fs/cgroup/blkio/" |
#define TR_CGROUP_SET_PID "tasks" |
#define TR_CGROUP_WEIGHT_PREFIX "blkio" |
#define tr_info_list_traverse | ( | ptr, | |
head | |||
) | for (ptr = head; ptr != NULL; ptr = ptr->next) |
#define tr_json_field_traverse | ( | ptr, | |
begin, | |||
end | |||
) | for (ptr = begin; ptr != end; ptr++) |
Traverse the tr_json_field
structures.
[out] | ptr | Current pointer of tr_json_field structures. |
[in] | begin | Start pointer of the traverse. |
[in] | end | End pointer of the traverse. |
anonymous enum |
anonymous enum |
void tr_free | ( | void | ) |
Deallocate resources of this driver.
int tr_get_interval | ( | const char * | key, |
char * | buffer | ||
) |
Get execution-time results from trace-replay
.
[in] | key | cgroup_id value which specifies the location of data I want to get. |
[out] | buffer | Data contains the execution-time results based on key . |
log.type
for success to get information, negative value for fail to get information. buffer
must be allocated memory over and equal INTERVAL_RESULT_STRING_SIZE
int tr_get_total | ( | const char * | key, |
char * | buffer | ||
) |
Get end-time results from trace-replay
.
[in] | key | cgroup_id value which specifies the location of data I want to get. |
[out] | buffer | Data contains the end-time results based on key . |
buffer
must be allocated memory over and equal TOTAL_RESULT_STRING_SIZE
int tr_has_weight_scheduler | ( | const int | scheduler_index | ) |
Check the parameter's scheduler_index
supports weight.
[in] | scheduler_index | The scheduler's index which is based on tr_valid_scheduler and wants to check. |
struct tr_info* tr_info_init | ( | struct json_object * | setting, |
int | index | ||
) |
Generate and construct the per processes info
object and return it.
[in] | setting | JSON object pointer which has the setting value. |
[in] | index | task_option array's index. |
int tr_init | ( | void * | object | ) |
Initialize the global configuration and per processes configuration.
[in] | object | global runner_config pointer. |
void tr_mq_free | ( | struct tr_info * | info, |
int | flags | ||
) |
Deallocate the Message Queue resources.
[in] | info | tr_info structure which wants to deallocate. |
[in] | flags | Set a range of deallocation. |
int tr_mq_get | ( | const struct tr_info * | info, |
void * | buffer | ||
) |
Retrieve the data from Message Queue.
[in] | info | tr_info structure which wants to get data. |
[out] | buffer | Destination of data will be stored |
int tr_mq_init | ( | struct tr_info * | info | ) |
Wrapping function of __tr_mq_init()
[in] | info | tr_info structure which wants to init. |
void tr_realtime_serializer | ( | const struct tr_info * | info, |
const struct realtime_log * | log, | ||
char * | buffer | ||
) |
Converts realtime_log
to JSON string.
[in] | info | tr_info structure's pointer. |
[in] | log | realtime_log structure's pointer. |
[out] | buffer | Data contains the execution-time results which are converted to JSON. |
buffer
must be allocated memory over and equal INTERVAL_RESULT_STRING_SIZE
int tr_runner | ( | void | ) |
Run all processes' trace-replay
part.
void tr_shm_free | ( | struct tr_info * | info, |
int | flags | ||
) |
Deallocate the Shared Memory resources.
[in] | info | tr_info structure which wants to deallocate. |
[in] | flags | Set a range of deallocation. |
int tr_shm_get | ( | const struct tr_info * | info, |
void * | buffer | ||
) |
Retrieve the data from Shared Memory.
[in] | info | tr_info structure which wants to get data. |
[out] | buffer | Destination of data will be stored |
int tr_shm_init | ( | struct tr_info * | info | ) |
Do the __tr_shm_init()
and __tr_sem_init()
[in] | info | tr_info structure which wants to init. |
void tr_total_serializer | ( | const struct tr_info * | info, |
const struct total_results * | total, | ||
char * | buffer | ||
) |
Converts total_results
to JSON string.
[in] | info | tr_info structure's pointer. |
[in] | total | total_results structure's pointer. |
[out] | buffer | Data contains the end-time results which are converted to JSON. |
buffer
must be allocated memory over and equal TOTAL_RESULT_STRING_SIZE
int tr_valid_scheduler_test | ( | const char * | scheduler | ) |
Check the current inputted scheduler text can be supported by the driver.
[in] | scheduler | Inputted scheduler string. |