修改log参数,未修改完

sledge_graph
hwwang 5 months ago
parent 3aeed6f94b
commit 7abc07445d

@ -1,3 +1,3 @@
LD_LIBRARY_PATH=/home/hai/sledge-old/runtime/bin
SLEDGE_SCHEDULER=EDF
SLEDGE_SANDBOX_PERF_LOG=/home/hai/sledge-serverless-framework/debuglog.txt
SLEDGE_SANDBOX_PERF_LOG=/home/hai/sledge-old/runtime_sandbox_perf_log.log

@ -9,7 +9,8 @@
"defines": [
"USE_MEM_VM",
"x86_64",
"_GNU_SOURCE"
"_GNU_SOURCE",
"LOG_TO_FILE"
],
"cStandard": "${default}",
"compilerPath": "/usr/bin/clang",

@ -59,7 +59,7 @@ CFLAGS += -DLOG_TO_FILE
# CFLAGS += -DLOG_PREEMPTION
# CFLAGS += -DLOG_MODULE_LOADING
# CFLAGS += -DOPT_AVOID_GLOBAL_QUEUE
CFLAGS += -DLOG_RUNTIME_FILE_LOG
#CFLAGS += -DLOG_RUNTIME_FILE_LOG
CFLAGS += -DLOG_RUNTIME_MEM_LOG
# This dumps per module *.csv files containing the cycle a sandbox has been in RUNNING when each

File diff suppressed because one or more lines are too long

@ -263,7 +263,7 @@ current_sandbox_start(void)
uint64_t enqueue_timestamp = __getcycles();
const char *previous_output = sandbox_request->previous_function_output ? sandbox_request->previous_function_output : "";
int new_output_length = strlen(previous_output) + output_length + 2;
int new_output_length = strlen(previous_output) + output_length + 1;
char *new_output = (char *)malloc(new_output_length);
if (!new_output) {
fprintf(stderr, "Failed to allocate memory for the new output: %s\n", strerror(errno));

@ -9,6 +9,8 @@
#include "runtime.h"
extern uint64_t system_start_timestamp;
/*When reading the json file, the size has been determined at module.c JSON_MAX_ELEMENT_COUNT*/
const int QUEUE_SIZE = 16;
/*
* Descriptor of the epoll instance used to monitor the socket descriptors of registered
* serverless modules. The listener cores listens for incoming client requests through this.
@ -176,13 +178,27 @@ listener_thread_main(void *dummy)
continue;
}
/* get total estimated execution time */
uint64_t estimated_execution_time = admission_info_get_percentile(&module->admissions_info);
struct module * next_module = module;
while(next_module) {
estimated_execution_time += admission_info_get_percentile(&next_module->admissions_info);
next_module = next_module->next_module;
}
uint64_t estimated_execution_time = 0;
int front = 0, rear = 0;
struct module **queue = malloc(QUEUE_SIZE * sizeof(struct module*));
if (queue == NULL) {
panic("Failed to allocate listen.c queue memory for queue");
}
queue[rear++] = module;
while (rear != front)
{
struct module *current_module = queue[front++];
estimated_execution_time += admission_info_get_percentile(&current_module->admissions_info);
for (int i = 0; i < current_module->next_module_count; i++) {
if (current_module->next_module[i] != NULL)
{
queue[rear++] = current_module->next_module[i];
}
}
assert(rear <= QUEUE_SIZE);
assert(front <= QUEUE_SIZE);
}
free(queue);
/* Adding system start timestamp to avoid negative remaining slack in the following update. They are all cycles */
uint64_t remaining_slack = system_start_timestamp + module->relative_deadline - estimated_execution_time;

@ -228,6 +228,7 @@ runtime_configure()
if (runtime_sandbox_perf_log == NULL) { perror("sandbox perf log"); }
fprintf(runtime_sandbox_perf_log, "threadid,id,function,state,deadline,actual,queued,initializing,runnable,"
"running,blocked,returned,memory\n");
//fflush(runtime_sandbox_perf_log);
} else {
printf("\tSandbox Performance Log: Disabled\n");
}

@ -20,6 +20,7 @@
const int JSON_MAX_ELEMENT_COUNT = 16;
const int JSON_MAX_ELEMENT_SIZE = 1024;
const int PRE_MODULE_COUNT = 4;
struct module **nodes;
/*************************
* Private Static Inline *
@ -376,7 +377,7 @@ module_new_from_json(char *file_name)
char *request_headers = NULL;
char *reponse_headers = NULL;
//struct module *tail_module = NULL;
struct module **nodes = malloc(JSON_MAX_ELEMENT_COUNT * sizeof(struct module*));
nodes = malloc(JSON_MAX_ELEMENT_COUNT * sizeof(struct module*));
if (nodes == NULL) {
fprintf(stderr, "Memory allocation failed for nodes array\n");
}
@ -660,7 +661,7 @@ module_new_from_json(char *file_name)
}
}
}
free(nodes);
//free(nodes);
#ifdef LOG_MODULE_LOADING
debuglog("Loaded %d module%s!\n", module_count, module_count > 1 ? "s" : "");
#endif

@ -2,7 +2,7 @@ include Makefile.inc
#TESTS=fibonacci fibonacci2 fibonacci3 big_fibonacci C-Image-Manip empty work work1k work10k work100k work1m forever filesys sockserver sockclient empty
TESTS=fibonacci big_fibonacci C-Image-Manip empty work work1k work10k work100k work1m forever filesys sockserver sockclient empty
TESTS2=
TESTS2=fibonacciadd
TESTSRT=$(TESTS:%=%_rt)
TESTSRT2=$(TESTS2:%=%_rt)

@ -0,0 +1,46 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
unsigned long int fib(unsigned long int n) {
if (n <= 1) return n;
return fib(n - 1) + fib(n - 2);
}
int main() {
char buffer[1024]; // Buffer to store input data
// Read data from stdin into buffer
ssize_t bytes_read = read(0, buffer, sizeof(buffer) - 1);
if (bytes_read < 0) {
perror("Error reading input");
return 1;
}
buffer[bytes_read] = '\0'; // Null-terminate the string
// Variables to store the two numbers
unsigned long int num1, num2;
// Split the input into two parts based on newline and parse them
char *line = strtok(buffer, "+");
if (line != NULL && sscanf(line, "%lu", &num1) == 1) {
line = strtok(NULL, "\n");
if (line != NULL && sscanf(line, "%lu", &num2) == 1) {
// Calculate Fibonacci numbers and their sum
unsigned long int fib1 = fib(num1);
unsigned long int fib2 = fib(num2);
unsigned long int sum = fib1 + fib2;
printf("Fibonacci(%lu) + Fibonacci(%lu) = %lu + %lu = %lu\n", num1, num2, fib1, fib2, sum);
} else {
printf("Invalid input. Please enter two numbers on separate lines.\n");
return 1;
}
} else {
printf("Invalid input. Please enter two numbers on separate lines.\n");
return 1;
}
return 0;
}

Binary file not shown.

@ -49,7 +49,7 @@
{
"active": true,
"name": "work4",
"path": "work_wasm.so",
"path": "fibonacciadd_wasm.so",
"port": 10003,
"relative-deadline-us": 50000,
"argsize": 1,

@ -2703,7 +2703,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
"version": "3.1.undefined"
}
},
"nbformat": 4,

@ -11,7 +11,7 @@ Runtime Environment:
Sigalrm Policy: BROADCAST
Preemption: Enabled
Quantum: 5000 us
Sandbox Performance Log: /home/hai/sledge-serverless-framework/debuglog.txt
Sandbox Performance Log: /home/hai/sledge-old/runtime_sandbox_perf_log.log
Starting listener thread
Listener core thread: 7ffff7a006c0
Starting 6 worker thread(s)

Loading…
Cancel
Save