make running_time more accurate

main
xiaosuGW 3 years ago
parent edad16ba75
commit 9c8e7f0b88

@ -40,11 +40,11 @@ sandbox_set_as_running(struct sandbox *sandbox, sandbox_state_t last_state)
} }
} }
sandbox->last_state_change_timestamp = now;
sandbox->state = SANDBOX_RUNNING;
/* State Change Bookkeeping */ /* State Change Bookkeeping */
sandbox_state_log_transition(sandbox->id, last_state, SANDBOX_RUNNING); sandbox_state_log_transition(sandbox->id, last_state, SANDBOX_RUNNING);
runtime_sandbox_total_increment(SANDBOX_RUNNING); runtime_sandbox_total_increment(SANDBOX_RUNNING);
runtime_sandbox_total_decrement(last_state); runtime_sandbox_total_decrement(last_state);
sandbox->last_state_change_timestamp = now;
sandbox->state = SANDBOX_RUNNING;
} }

@ -192,6 +192,8 @@ software_interrupt_handle_signals(int signal_type, siginfo_t *signal_info, void
debuglog("Restoring sandbox: %lu, Stack %llu\n", current_sandbox->id, debuglog("Restoring sandbox: %lu, Stack %llu\n", current_sandbox->id,
current_sandbox->ctxt.mctx.gregs[REG_RSP]); current_sandbox->ctxt.mctx.gregs[REG_RSP]);
#endif #endif
uint64_t now = __getcycles();
current_sandbox->last_state_change_timestamp = now;
arch_mcontext_restore(&user_context->uc_mcontext, &current_sandbox->ctxt); arch_mcontext_restore(&user_context->uc_mcontext, &current_sandbox->ctxt);
goto done; goto done;
} }

Loading…
Cancel
Save