feat: precomp module deadline cycles

main
Sean McBride 4 years ago
parent 1b58f819a7
commit ba4f9e2119

@ -32,6 +32,7 @@ struct module {
uint32_t stack_size; /* a specification? */ uint32_t stack_size; /* a specification? */
uint64_t max_memory; /* perhaps a specification of the module. (max 4GB) */ uint64_t max_memory; /* perhaps a specification of the module. (max 4GB) */
uint32_t relative_deadline_us; uint32_t relative_deadline_us;
uint64_t relative_deadline; /* cycles */
uint32_t reference_count; /* ref count how many instances exist here. */ uint32_t reference_count; /* ref count how many instances exist here. */
struct indirect_table_entry indirect_table[INDIRECT_TABLE_SIZE]; struct indirect_table_entry indirect_table[INDIRECT_TABLE_SIZE];
struct sockaddr_in socket_address; struct sockaddr_in socket_address;

@ -14,6 +14,7 @@
#define RUNTIME_READ_WRITE_VECTOR_LENGTH 16 #define RUNTIME_READ_WRITE_VECTOR_LENGTH 16
extern int runtime_epoll_file_descriptor; extern int runtime_epoll_file_descriptor;
extern float runtime_processor_speed_MHz;
extern uint32_t runtime_total_worker_processors; extern uint32_t runtime_total_worker_processors;
extern pthread_t runtime_worker_threads[]; extern pthread_t runtime_worker_threads[];

@ -7,8 +7,6 @@
#include "module.h" #include "module.h"
#include "runtime.h" #include "runtime.h"
extern float runtime_processor_speed_MHz;
struct sandbox_request { struct sandbox_request {
struct module * module; struct module * module;
char * arguments; char * arguments;
@ -40,8 +38,7 @@ sandbox_request_allocate(struct module *module, char *arguments, int socket_desc
sandbox_request->socket_descriptor = socket_descriptor; sandbox_request->socket_descriptor = socket_descriptor;
sandbox_request->socket_address = (struct sockaddr *)socket_address; sandbox_request->socket_address = (struct sockaddr *)socket_address;
sandbox_request->request_arrival_timestamp = request_arrival_timestamp; sandbox_request->request_arrival_timestamp = request_arrival_timestamp;
sandbox_request->absolute_deadline = request_arrival_timestamp sandbox_request->absolute_deadline = request_arrival_timestamp + module->relative_deadline;
+ module->relative_deadline_us * runtime_processor_speed_MHz;
debuglog("Allocating %lu of %s:%d\n", sandbox_request->request_arrival_timestamp, sandbox_request->module->name, debuglog("Allocating %lu of %s:%d\n", sandbox_request->request_arrival_timestamp, sandbox_request->module->name,
sandbox_request->module->port); sandbox_request->module->port);

@ -166,6 +166,7 @@ module_new(char *name, char *path, int32_t argument_count, uint32_t stack_size,
module->stack_size = round_up_to_page(stack_size == 0 ? WASM_STACK_SIZE : stack_size); module->stack_size = round_up_to_page(stack_size == 0 ? WASM_STACK_SIZE : stack_size);
module->max_memory = max_memory == 0 ? ((uint64_t)WASM_PAGE_SIZE * WASM_MAX_PAGES) : max_memory; module->max_memory = max_memory == 0 ? ((uint64_t)WASM_PAGE_SIZE * WASM_MAX_PAGES) : max_memory;
module->relative_deadline_us = relative_deadline_us; module->relative_deadline_us = relative_deadline_us;
module->relative_deadline = relative_deadline_us * runtime_processor_speed_MHz;
module->socket_descriptor = -1; module->socket_descriptor = -1;
module->port = port; module->port = port;

Loading…
Cancel
Save