mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-11-28 07:45:32 +00:00
hv: trace: show cpu usage of vms in pcpu sharing case
To maximize the cpu utilization, core 0 is usually shared by service vm and guest vm. But there are no statistics to show the cpu occupation of each vm. This patch is to provide cpu usage statistic for users. To calculate it, a new trace event is added and marked in scheduling context switch, accompanying with a new python script to analyze the data from acrntrace output. Tracked-On: #8621 Signed-off-by: nacui <na.cui@intel.com> Reviewed-by: Junjie Mao <junjie.mao@intel.com> Reviewed-by: Haiwei Li <haiwei.li@intel.com>
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include <schedule.h>
|
||||
#include <sprintf.h>
|
||||
#include <asm/irq.h>
|
||||
#include <trace.h>
|
||||
|
||||
bool is_idle_thread(const struct thread_object *obj)
|
||||
{
|
||||
@@ -172,6 +173,7 @@ void schedule(void)
|
||||
struct thread_object *next = &per_cpu(idle, pcpu_id);
|
||||
struct thread_object *prev = ctl->curr_obj;
|
||||
uint64_t rflag;
|
||||
char name[16];
|
||||
|
||||
obtain_schedule_lock(pcpu_id, &rflag);
|
||||
if (ctl->scheduler->pick_next != NULL) {
|
||||
@@ -182,6 +184,10 @@ void schedule(void)
|
||||
/* If we picked different sched object, switch context */
|
||||
if (prev != next) {
|
||||
if (prev != NULL) {
|
||||
memcpy_erms(name, prev->name, 4);
|
||||
memcpy_erms(name + 4, next->name, 4);
|
||||
memset(name + 8, 0, sizeof(name) - 8);
|
||||
TRACE_16STR(TRACE_SCHED_NEXT, name);
|
||||
if (prev->switch_out != NULL) {
|
||||
prev->switch_out(prev);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user