添加output2

tree
hwwang 1 year ago
parent cc7b810fd0
commit dcfab6f1c0

@ -56,5 +56,30 @@
}
]
}
{
"name": "feibonaqie",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/runtime/bin/sledgert",
"args": [
"${workspaceFolder}/runtime/tests/test_fibonacci.json"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"sourceFileMap": {
"/sledge/runtime": "${workspaceFolder}/runtime"
},
"envFile": "${workspaceFolder}/.env",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

@ -95,7 +95,8 @@
"compare": "c",
"cstdint": "c",
"format": "c",
"jsmn.h": "c"
"jsmn.h": "c",
"priority_queue.h": "c"
},
"files.exclude": {
"**/.git": true,
@ -207,4 +208,4 @@
"C_Cpp_Runner.msvcSecureNoWarnings": false,
"git.detectSubmodules": true,
"git.enabled": true
}
}

@ -85,9 +85,9 @@ struct module {
/* the left and right children module in the tree */
struct module *left_module;
struct module *right_module;
struct module *parent_module;
/* parent module or not?*/
bool is_parent;
bool is_sandboxcreate;
};
/*************************

@ -226,7 +226,7 @@ sandbox_mem_print_perf(struct sandbox *sandbox)
uint64_t returned_us = sandbox->returned_duration / runtime_processor_speed_MHz;
//if (sandbox->module->next_module == NULL) {
if(sandbox->module->is_parent) {
if(sandbox->module->parent_module == NULL) {
uint64_t total_time = (sandbox->completion_timestamp - sandbox->request_arrival_timestamp) / runtime_processor_speed_MHz;
bool miss_deadline = sandbox->completion_timestamp > sandbox->absolute_deadline ? true : false;
uint64_t delayed_us = (sandbox->completion_timestamp - sandbox->absolute_deadline)

@ -26,6 +26,7 @@ struct sandbox_request {
uint64_t last_update_timestamp; /* cycles */
uint64_t remaining_slack; /* cycles */
char * previous_function_output;
char * previous_function_output2;
ssize_t output_length;
ssize_t previous_request_length;
/*
@ -74,7 +75,7 @@ static inline struct sandbox_request *
sandbox_request_allocate(struct module *module, bool request_from_outside, ssize_t request_length,
char *arguments, int socket_descriptor, const struct sockaddr *socket_address,
uint64_t request_arrival_timestamp, uint64_t enqueue_timestamp, uint64_t remaining_slack,
uint64_t admissions_estimate, char *previous_function_output, ssize_t output_length)
uint64_t admissions_estimate, char *previous_function_output, char * previous_function_output2, ssize_t output_length)
{
struct sandbox_request *sandbox_request = (struct sandbox_request *)malloc(sizeof(struct sandbox_request));
assert(sandbox_request);
@ -91,6 +92,7 @@ sandbox_request_allocate(struct module *module, bool request_from_outside, ssize
sandbox_request->enqueue_timestamp = enqueue_timestamp;
sandbox_request->absolute_deadline = request_arrival_timestamp + module->relative_deadline;
sandbox_request->previous_function_output = previous_function_output;
sandbox_request->previous_function_output2 = previous_function_output2;
sandbox_request->output_length = output_length;
sandbox_request->previous_request_length = request_length;
sandbox_request->last_update_timestamp = enqueue_timestamp;

@ -33,6 +33,7 @@ struct sandbox {
uint64_t id;
bool request_from_outside;
char * previous_function_output; /* the output of the previous function */
char * previous_function_output2;
ssize_t output_length; /* the length of previous_function_output */
ssize_t previous_request_length; /* the length of previous request */
sandbox_state_t state;

@ -71,7 +71,7 @@ current_sandbox_start(void)
sandbox_initialize_stdio(sandbox);
//struct module * next_module = sandbox->module->next_module;
struct module * next_module = sandbox->module->left_module;
struct module * next_module = sandbox->module->parent_module;
/*
* Add the client fd to epoll if it is the first or last sandbox in the chain because they
@ -84,7 +84,7 @@ current_sandbox_start(void)
if (sandbox->request_from_outside) {
if (sandbox_receive_request(sandbox) < 0) {
error_message = "Unable to receive or parse client request\n";
goto err;
goto err;
}
} else {
/*
@ -132,17 +132,37 @@ current_sandbox_start(void)
//uint64_t current_rs = enqueue_timestamp - system_start_timestamp;
//mem_log("time %lu request id:%d executing, name:%s remaining slack %lu\n", current_rs,
// sandbox->id, sandbox->module->name, sandbox->remaining_slack);
struct sandbox_request *sandbox_request =
sandbox_request_allocate(next_module, false, sandbox->request_length,
next_module->name, sandbox->client_socket_descriptor,
(const struct sockaddr *)&sandbox->client_address,
sandbox->request_arrival_timestamp, enqueue_timestamp,
sandbox->remaining_slack, true, pre_func_output, output_length);
/* TODO: All sandboxs in the chain share the same request id, but sandbox_request_allocate()
* will busy-wait to generate an unique id, should we optimize it here?
*/
sandbox_request->id = sandbox->id;
#ifdef OPT_AVOID_GLOBAL_QUEUE
if (next_module->is_sandboxcreate == false)
{
if (strcpy(next_module->left_module->name, sandbox->module->name) == 0)
{
struct sandbox_request *sandbox_request =
sandbox_request_allocate(next_module, false, sandbox->request_length,
next_module->name, sandbox->client_socket_descriptor,
(const struct sockaddr *)&sandbox->client_address,
sandbox->request_arrival_timestamp, enqueue_timestamp,
sandbox->remaining_slack, true, pre_func_output,NULL, output_length);
/* TODO: All sandboxs in the chain share the same request id, but sandbox_request_allocate()
* will busy-wait to generate an unique id, should we optimize it here?
*/
sandbox_request->id = sandbox->id;
}else
{
struct sandbox_request *sandbox_request =
sandbox_request_allocate(next_module, false, sandbox->request_length,
next_module->name, sandbox->client_socket_descriptor,
(const struct sockaddr *)&sandbox->client_address,
sandbox->request_arrival_timestamp, enqueue_timestamp,
sandbox->remaining_slack, true, pre_func_output,NULL, output_length);
sandbox_request->id = sandbox->id;
}
/*the first exed module creat next sandbox_request*/
next_module->parent_module->is_sandboxcreate == true;
}else
{
//此处需要两个任务1.读取创建的父节点sandbox_request;2.是否合并上述两个节点的output作为一个input
#ifdef OPT_AVOID_GLOBAL_QUEUE
/* TODO: The running time of the current sandbox contains the next sandbox's initialization time, does it matter? */
if (sandbox->absolute_deadline == sandbox_request->absolute_deadline) {
/* Put the next sandbox to the local run queue to reduce the overhead of the global queue */
@ -167,6 +187,7 @@ current_sandbox_start(void)
sandbox_remove_from_epoll(sandbox);
}
sandbox_set_as_returned(sandbox, SANDBOX_RUNNING);
}
} else {
/* Retrieve the result, construct the HTTP response, and send to client */
if (sandbox_send_response(sandbox) < 0) {

@ -622,6 +622,8 @@ module_new_from_json(char *file_name)
response_count, reponse_headers, response_content_type);
module->left_module = NULL;
module->right_module = NULL;
module->parent_module = NULL;
module->is_sandboxcreate = false;
nodes[module_count] = module;
module_count++;
}
@ -634,18 +636,18 @@ module_new_from_json(char *file_name)
for (int i = 0; i < module_count; i++)
{
int left_index = 2 * i + 1;
int right_index = 2 * i + 2;
assert(nodes[left_index]);
assert(nodes[right_index]);
int right_index = 2 * i + 2;
if (left_index < module_count)
{
assert(nodes[left_index]);
nodes[i]->left_module = nodes[left_index];
nodes[left_index]->parent_nodes = nodes[i];
nodes[left_index]->parent_module = nodes[i];
}
if (right_index < module_count)
{
assert(nodes[right_index]);
nodes[i]->right_module = nodes[right_index];
nodes[right_index]->parent_nodes = nodes[i];
nodes[right_index]->parent_module = nodes[i];
}
}
free(nodes);

@ -3,8 +3,8 @@
"name": "fibonacci",
"path": "fibonacci_wasm.so",
"port": 10000,
"expected-execution-us": 600,
"relative-deadline-us": 2000,
"expected-execution-us": 5000,
"relative-deadline-us": 360000,
"argsize": 1,
"http-req-headers": [],
"http-req-content-type": "text/plain",

@ -0,0 +1,22 @@
Runtime Environment:
CPU Speed: 2400 MHz
Processor Speed: 2400 MHz
RLIMIT_DATA: Infinite
RLIMIT_NOFILE: 1048576 (Increased from 8192)
Core Count: 8
Listener core ID: 1
First Worker core ID: 2
Worker core count: 6
Scheduler Policy: EDF
Sigalrm Policy: BROADCAST
Preemption: Enabled
Quantum: 5000 us
Sandbox Performance Log: Disabled
Starting listener thread
Listener core thread: 7ffff7a006c0
Starting 6 worker thread(s)
C: 01, T: 0x7ffff7bfdd80, F: runtime_start_runtime_worker_threads>
Sandboxing environment ready!
C: 01, T: 0x7ffff7bfdd80, F: module_new>
Stack Size: 524288
Loading…
Cancel
Save