chore: make durations uint32_t

main
Sean McBride 4 years ago
parent 392d04423a
commit 82d0505104

@ -20,7 +20,7 @@
* This provides a sorted circular buffer
*/
struct execution_node {
uint64_t execution_time;
uint32_t execution_time;
uint16_t buffer_idx; /* Reverse Index back to the sorted bin equal to this index */
};
@ -68,8 +68,8 @@ perf_window_swap(struct perf_window *self, uint16_t first_sorted_idx, uint16_t s
assert(self->buffer[first_buffer_idx] == first_sorted_idx);
assert(self->buffer[second_buffer_idx] == second_sorted_idx);
uint64_t first_execution_time = self->sorted[first_sorted_idx].execution_time;
uint64_t second_execution_time = self->sorted[second_sorted_idx].execution_time;
uint32_t first_execution_time = self->sorted[first_sorted_idx].execution_time;
uint32_t second_execution_time = self->sorted[second_sorted_idx].execution_time;
/* Swap Indices in Buffer*/
self->buffer[first_buffer_idx] = second_sorted_idx;
@ -92,7 +92,7 @@ perf_window_swap(struct perf_window *self, uint16_t first_sorted_idx, uint16_t s
* @param value
*/
static inline void
perf_window_add(struct perf_window *self, uint64_t value)
perf_window_add(struct perf_window *self, uint32_t value)
{
assert(self != NULL);
@ -152,7 +152,7 @@ done:
* @param percentile represented by double between 0 and 1
* @returns execution time or -1 if buffer is empty
*/
static inline uint64_t
static inline uint32_t
perf_window_get_percentile(struct perf_window *self, double percentile)
{
assert(self != NULL);

@ -71,12 +71,12 @@ struct sandbox {
uint64_t last_state_change_timestamp; /* Used for bookkeeping of actual execution time */
/* Duration of time (in cycles) that the sandbox is in each state */
uint64_t initializing_duration;
uint64_t runnable_duration;
uint64_t preempted_duration;
uint64_t running_duration;
uint64_t blocked_duration;
uint64_t returned_duration;
uint32_t initializing_duration;
uint32_t runnable_duration;
uint32_t preempted_duration;
uint32_t running_duration;
uint32_t blocked_duration;
uint32_t returned_duration;
uint64_t absolute_deadline;
uint64_t total_time; /* From Request to Response */
@ -317,18 +317,18 @@ sandbox_get_libuv_handle(struct sandbox *sandbox, int io_handle_index)
static inline void
sandbox_print_perf(struct sandbox *sandbox)
{
uint64_t total_time_us = sandbox->total_time / runtime_processor_speed_MHz;
uint64_t queued_us = (sandbox->allocation_timestamp - sandbox->request_arrival_timestamp)
uint32_t total_time_us = sandbox->total_time / runtime_processor_speed_MHz;
uint32_t queued_us = (sandbox->allocation_timestamp - sandbox->request_arrival_timestamp)
/ runtime_processor_speed_MHz;
uint64_t initializing_us = sandbox->initializing_duration / runtime_processor_speed_MHz;
uint64_t runnable_us = sandbox->runnable_duration / runtime_processor_speed_MHz;
uint64_t running_us = sandbox->running_duration / runtime_processor_speed_MHz;
uint64_t blocked_us = sandbox->blocked_duration / runtime_processor_speed_MHz;
uint64_t returned_us = sandbox->returned_duration / runtime_processor_speed_MHz;
debuglog("%lu, %s():%d, state: %s, deadline: %u, actual: %lu, queued: %lu, initializing: %lu, runnable: %lu, "
"running: "
"%lu, blocked: "
"%lu, returned %lu\n",
uint32_t initializing_us = sandbox->initializing_duration / runtime_processor_speed_MHz;
uint32_t runnable_us = sandbox->runnable_duration / runtime_processor_speed_MHz;
uint32_t running_us = sandbox->running_duration / runtime_processor_speed_MHz;
uint32_t blocked_us = sandbox->blocked_duration / runtime_processor_speed_MHz;
uint32_t returned_us = sandbox->returned_duration / runtime_processor_speed_MHz;
debuglog("%lu, %s():%d, state: %s, deadline: %u, actual: %u, queued: %u, initializing: %u, runnable: %u, "
"running: %u, "
"blocked: %u, "
"returned %u\n",
sandbox->request_arrival_timestamp, sandbox->module->name, sandbox->module->port,
sandbox_state_stringify(sandbox->state), sandbox->module->relative_deadline_us, total_time_us,
queued_us, initializing_us, runnable_us, running_us, blocked_us, returned_us);

@ -98,7 +98,7 @@ listener_thread_main(void *dummy)
/* Perform Admission Control */
uint64_t estimated_execution = perf_window_get_percentile(&module->perf_window, 0.5);
uint32_t estimated_execution = perf_window_get_percentile(&module->perf_window, 0.5);
/*
* If this is the first execution, assume a default execution
* TODO: Enhance module specification to provide "seed" value of estimated duration

@ -501,7 +501,7 @@ sandbox_set_as_runnable(struct sandbox *sandbox, sandbox_state_t last_state)
assert(!software_interrupt_is_enabled());
uint64_t now = __getcycles();
uint64_t duration_of_last_state = now - sandbox->last_state_change_timestamp;
uint32_t duration_of_last_state = now - sandbox->last_state_change_timestamp;
sandbox->state = SANDBOX_SET_AS_RUNNABLE;
debuglog("Sandbox %lu | %s => Runnable\n", sandbox->request_arrival_timestamp,
@ -547,7 +547,7 @@ sandbox_set_as_running(struct sandbox *sandbox, sandbox_state_t last_state)
assert(!software_interrupt_is_enabled());
uint64_t now = __getcycles();
uint64_t duration_of_last_state = now - sandbox->last_state_change_timestamp;
uint32_t duration_of_last_state = now - sandbox->last_state_change_timestamp;
sandbox->state = SANDBOX_SET_AS_RUNNING;
debuglog("Sandbox %lu | %s => Running\n", sandbox->request_arrival_timestamp,
@ -590,7 +590,7 @@ sandbox_set_as_preempted(struct sandbox *sandbox, sandbox_state_t last_state)
assert(!software_interrupt_is_enabled());
uint64_t now = __getcycles();
uint64_t duration_of_last_state = now - sandbox->last_state_change_timestamp;
uint32_t duration_of_last_state = now - sandbox->last_state_change_timestamp;
sandbox->state = SANDBOX_SET_AS_PREEMPTED;
debuglog("Sandbox %lu | %s => Preempted\n", sandbox->request_arrival_timestamp,
@ -626,7 +626,7 @@ sandbox_set_as_blocked(struct sandbox *sandbox, sandbox_state_t last_state)
assert(!software_interrupt_is_enabled());
uint64_t now = __getcycles();
uint64_t duration_of_last_state = now - sandbox->last_state_change_timestamp;
uint32_t duration_of_last_state = now - sandbox->last_state_change_timestamp;
sandbox->state = SANDBOX_SET_AS_BLOCKED;
debuglog("Sandbox %lu | %s => Blocked\n", sandbox->request_arrival_timestamp,
@ -664,7 +664,7 @@ sandbox_set_as_returned(struct sandbox *sandbox, sandbox_state_t last_state)
assert(!software_interrupt_is_enabled());
uint64_t now = __getcycles();
uint64_t duration_of_last_state = now - sandbox->last_state_change_timestamp;
uint32_t duration_of_last_state = now - sandbox->last_state_change_timestamp;
sandbox->state = SANDBOX_SET_AS_RETURNED;
debuglog("Sandbox %lu | %s => Returned\n", sandbox->request_arrival_timestamp,
@ -707,7 +707,7 @@ sandbox_set_as_error(struct sandbox *sandbox, sandbox_state_t last_state)
assert(sandbox);
uint64_t now = __getcycles();
uint64_t duration_of_last_state = now - sandbox->last_state_change_timestamp;
uint32_t duration_of_last_state = now - sandbox->last_state_change_timestamp;
sandbox->state = SANDBOX_SET_AS_ERROR;
debuglog("Sandbox %lu | %s => Error\n", sandbox->request_arrival_timestamp,
@ -757,7 +757,7 @@ sandbox_set_as_complete(struct sandbox *sandbox, sandbox_state_t last_state)
{
assert(sandbox);
uint64_t now = __getcycles();
uint64_t duration_of_last_state = now - sandbox->last_state_change_timestamp;
uint32_t duration_of_last_state = now - sandbox->last_state_change_timestamp;
sandbox->state = SANDBOX_SET_AS_COMPLETE;
debuglog("Sandbox %lu | %s => Complete\n", sandbox->request_arrival_timestamp,

Loading…
Cancel
Save