debuggers.hg

view xen/include/xen/adv_sched_hist.h @ 4647:9c88ba91d330

bitkeeper revision 1.1346.1.1 (42670505dNhgnJm5dQD81pCalXMZgw)

manual merge
author iap10@freefall.cl.cam.ac.uk
date Thu Apr 21 01:42:29 2005 +0000 (2005-04-21)
parents 2d335430f7fc
children 86285c9c18c1
line source
1 /* Some functions to suport advanced scheduler histograms
2 Author: Stephan.Diestelhorst@cl.cam.ac.uk */
3 //#include <xen/sched.h>
4 //#include <xen/sched-if.h>
5 #include <asm/msr.h>
6 #define ADV_SCHED_HISTO
7 static inline void adv_sched_hist_start(int cpu) {
8 u64 now;
9 rdtscll(now);
10 if (!schedule_data[cpu].save_tsc)
11 schedule_data[cpu].save_tsc = now;
12 }
13 static inline void adv_sched_hist_from_stop(int cpu) {
14 u64 now;
15 rdtscll(now);
16 if (schedule_data[cpu].save_tsc) {
17 now -= schedule_data[cpu].save_tsc;
18 now /= 7;
19 if (now < BUCKETS-1)
20 schedule_data[cpu].from_hist[now]++;
21 else
22 schedule_data[cpu].from_hist[BUCKETS-1]++;
24 schedule_data[cpu].save_tsc = 0;
25 }
26 }
27 static inline void adv_sched_hist_to_stop(int cpu) {
28 u64 now;
29 rdtscll(now);
30 if (schedule_data[cpu].save_tsc) {
31 now -= schedule_data[cpu].save_tsc;
32 now /= 24;
33 if (now < BUCKETS-1)
34 schedule_data[cpu].to_hist[now]++;
35 else
36 schedule_data[cpu].to_hist[BUCKETS-1]++;
38 schedule_data[cpu].save_tsc = 0;
39 }
40 }