This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] sim: Better profiling


Hello All,

the appended patch uses a prime number to initialise the PC sampling
frequency, this makes scaling effects less likely.

It also fixes an endianness bug in the sample data printing.


Thiemo


2006-08-08  Nigel Stephens  <nigel@mips.com>

	* sim-profile.c (profile_pc_init): Initialise default profiling
	frequency to a prime number.
	(profile_print_pc): Convert gmon.out sample data into target
	byte order.


Index: sim/common/sim-profile.c
===================================================================
RCS file: /cvs/src/src/sim/common/sim-profile.c,v
retrieving revision 1.5
diff -u -p -r1.5 sim-profile.c
--- sim/common/sim-profile.c	15 Feb 2001 21:14:40 -0000	1.5
+++ sim/common/sim-profile.c	7 Aug 2006 16:52:17 -0000
@@ -519,7 +519,7 @@ profile_pc_init (SIM_DESC sd)
 	  int bucket_size;
 	  /* fill in the frequency if not specified */
 	  if (PROFILE_PC_FREQ (data) == 0)
-	    PROFILE_PC_FREQ (data) = 256;
+	    PROFILE_PC_FREQ (data) = 257;
 	  /* fill in the start/end if not specified */
 	  if (PROFILE_PC_END (data) == 0)
 	    {
@@ -700,6 +700,7 @@ profile_print_pc (sim_cpu *cpu, int verb
 	      sample = 0xffff;
 	    else
 	      sample = PROFILE_PC_COUNT (profile) [loop];
+ 	    H2T (sample);
 	    ok = fwrite (&sample, sizeof (sample), 1, pf);
 	  }
 	if (ok == 0)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]