WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Add cpufreq actual average freq informati

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Add cpufreq actual average freq information to xenpm tools
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 20 Mar 2009 08:40:17 -0700
Delivery-date: Fri, 20 Mar 2009 08:41:53 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1237538957 0
# Node ID 2a373e32b04d05b64048d26c8faf152026ec93b5
# Parent  0fc0de02856acae11dcea4b38a2fde9ece03a02a
Add cpufreq actual average freq information to xenpm tools

Signed-off-by: Liu, Jinsong <jinsong.liu@xxxxxxxxx>
---
 tools/misc/xenpm.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+)

diff -r 0fc0de02856a -r 2a373e32b04d tools/misc/xenpm.c
--- a/tools/misc/xenpm.c        Fri Mar 20 08:48:57 2009 +0000
+++ b/tools/misc/xenpm.c        Fri Mar 20 08:49:17 2009 +0000
@@ -222,6 +222,20 @@ static int get_pxstat_by_cpuid(int xc_fd
     return 0;
 }
 
+/* show cpu actual average freq information on CPU cpuid */
+static int get_avgfreq_by_cpuid(int xc_fd, int cpuid, int *avgfreq)
+{
+    int ret = 0;
+
+    ret = xc_get_cpufreq_avgfreq(xc_fd, cpuid, avgfreq);
+    if ( ret )
+    {
+        return errno;
+    }
+
+    return 0;
+}
+
 static int show_pxstat_by_cpuid(int xc_fd, int cpuid)
 {
     int ret = 0;
@@ -263,6 +277,7 @@ static uint64_t usec_start, usec_end;
 static uint64_t usec_start, usec_end;
 static struct xc_cx_stat *cxstat, *cxstat_start, *cxstat_end;
 static struct xc_px_stat *pxstat, *pxstat_start, *pxstat_end;
+static int *avgfreq;
 static uint64_t *sum, *sum_cx, *sum_px;
 
 static void signal_int_handler(int signo)
@@ -297,6 +312,9 @@ static void signal_int_handler(int signo
                     sum_px[i] += pxstat_end[i].pt[j].residency -
                                  pxstat_start[i].pt[j].residency;
     }
+
+    for ( i = 0; i < max_cpu_nr; i++ )
+        get_avgfreq_by_cpuid(xc_fd, i, &avgfreq[i]);
 
     printf("Elapsed time (ms): %"PRIu64"\n", (usec_end - usec_start) / 1000UL);
     for ( i = 0; i < max_cpu_nr; i++ )
@@ -329,6 +347,7 @@ static void signal_int_handler(int signo
                         res / 1000000UL, 100UL * res / (double)sum_px[i]);
             }
         }
+        printf("  Avg freq\t%d\tKHz\n", avgfreq[i]);
     }
 
     /* some clean up and then exits */
@@ -342,6 +361,7 @@ static void signal_int_handler(int signo
     free(cxstat);
     free(pxstat);
     free(sum);
+    free(avgfreq);
     xc_interface_close(xc_fd);
     exit(0);
 }
@@ -384,9 +404,18 @@ void start_gather_func(int argc, char *a
         free(cxstat);
         return ;
     }
+    avgfreq = malloc(sizeof(int) * max_cpu_nr);
+    if ( avgfreq == NULL )
+    {
+        free(sum);
+        free(cxstat);
+        free(pxstat);
+        return ;
+    }
     memset(sum, 0, sizeof(uint64_t) * 2 * max_cpu_nr);
     memset(cxstat, 0, sizeof(struct xc_cx_stat) * 2 * max_cpu_nr);
     memset(pxstat, 0, sizeof(struct xc_px_stat) * 2 * max_cpu_nr);
+    memset(avgfreq, 0, sizeof(int) * max_cpu_nr);
     sum_cx = sum;
     sum_px = sum + max_cpu_nr;
     cxstat_start = cxstat;
@@ -405,6 +434,7 @@ void start_gather_func(int argc, char *a
     {
         get_cxstat_by_cpuid(xc_fd, i, &cxstat_start[i]);
         get_pxstat_by_cpuid(xc_fd, i, &pxstat_start[i]);
+        get_avgfreq_by_cpuid(xc_fd, i, &avgfreq[i]);
     }
 
     if (signal(SIGINT, signal_int_handler) == SIG_ERR)
@@ -413,6 +443,7 @@ void start_gather_func(int argc, char *a
         free(sum);
         free(pxstat);
         free(cxstat);
+        free(avgfreq);
         return ;
     }
 
@@ -424,6 +455,7 @@ void start_gather_func(int argc, char *a
             free(sum);
             free(pxstat);
             free(cxstat);
+            free(avgfreq);
             return ;
         }
         alarm(timeout);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Add cpufreq actual average freq information to xenpm tools, Xen patchbot-unstable <=