From: "Jan Beulich" Subject: [PATCH] x86: adjust ptwr_eip_stat printing Date: Tue, 02 May 2006 16:26:44 +0200 Message-ID: <44578844.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part23063D34.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part23063D34.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline This patch changes to format in which EIP is printed to be consistent on 64-bit regardless of whether the addresses leading bits are set or clear. It additionally changes the formatting so that trailing spaces are avoided, and it suppresses the printing of empty records. It also prevents combining records with identical EIP but from different domains. It further changes the type of some variables from plain int to unsigned int, as that is yielding more efficient code on x86-64 (signed 32-bit array indices require explicit sign extension, whereas in most cases an extra copy can be avoided when the index type is unsigned, since all 32-bit operations already zero-extend their results). Signed-off-by: Jan Beulich --=__Part23063D34.0__= Content-Type: text/plain; name="xen-x86-ptwr-eip-stat-formatting.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xen-x86-ptwr-eip-stat-formatting.patch" --- 2006-04-27/xen/arch/x86/mm.c.0 2006-04-06 17:50:26.000000000 +0200 +++ 2006-04-27/xen/arch/x86/mm.c 2006-05-02 15:41:38.000000000 +0200 @@ -2917,7 +2917,7 @@ static inline unsigned int ptwr_eip_stat static void ptwr_eip_stat_inc(u32 *n) { - int i, j; + unsigned int i, j; if ( ++(*n) != 0 ) return; @@ -2925,14 +2925,14 @@ static void ptwr_eip_stat_inc(u32 *n) *n = ~0; /* Re-scale all buckets. */ - for ( i = 0; i >= 1; } static void ptwr_eip_stat_update(unsigned long eip, domid_t id, int modified) { - int i, j, b; + unsigned int i, j, b; i = b = ptwr_eip_stat_hash(eip, id); @@ -2946,7 +2946,7 @@ static void ptwr_eip_stat_update(unsigne memset(ptwr_eip_stats[i].val,0, sizeof(ptwr_eip_stats[i].val)); } - if ( ptwr_eip_stats[i].eip == eip ) + if ( ptwr_eip_stats[i].eip == eip && ptwr_eip_stats[i].id == id) { for ( j = 0; j < ptwr_eip_stat_thresholdN; j++ ) if ( modified <= ptwr_eip_stat_threshold[j] ) @@ -2975,7 +2975,7 @@ void ptwr_eip_stat_print(void) { struct domain *e; domid_t d; - int i, j; + unsigned int i, j; for_each_domain( e ) { @@ -2983,11 +2983,11 @@ void ptwr_eip_stat_print(void) for ( i = 0; i < ptwr_eip_buckets; i++ ) { - if ( ptwr_eip_stats[i].eip && ptwr_eip_stats[i].id != d ) + if ( !ptwr_eip_stats[i].eip || ptwr_eip_stats[i].id != d ) continue; - printk("D %d eip %08lx ", - ptwr_eip_stats[i].id, ptwr_eip_stats[i].eip); + printk("D %5d eip %p ", + ptwr_eip_stats[i].id, (void *)ptwr_eip_stats[i].eip); for ( j = 0; j < ptwr_eip_stat_thresholdN; j++ ) printk("<=%u %4u \t", --=__Part23063D34.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part23063D34.0__=--