svn commit: r235831 - in head/sys: arm/arm arm/include dev/hwpmc
Fabien Thomas
fabient at FreeBSD.org
Wed May 23 13:23:41 UTC 2012
Author: fabient
Date: Wed May 23 13:23:40 2012
New Revision: 235831
URL: http://svn.freebsd.org/changeset/base/235831
Log:
Soft PMC support for ARM.
Callgraph is not captured, only current location.
Sample system wide profiling: "pmcstat -Sclock.hard -T"
Modified:
head/sys/arm/arm/machdep.c
head/sys/arm/include/pmc_mdep.h
head/sys/dev/hwpmc/hwpmc_arm.c
Modified: head/sys/arm/arm/machdep.c
==============================================================================
--- head/sys/arm/arm/machdep.c Wed May 23 13:01:22 2012 (r235830)
+++ head/sys/arm/arm/machdep.c Wed May 23 13:23:40 2012 (r235831)
@@ -674,9 +674,9 @@ fake_preload_metadata(void)
static uint32_t fake_preload[35];
fake_preload[i++] = MODINFO_NAME;
- fake_preload[i++] = strlen("elf kernel") + 1;
- strcpy((char*)&fake_preload[i++], "elf kernel");
- i += 2;
+ fake_preload[i++] = strlen("kernel") + 1;
+ strcpy((char*)&fake_preload[i++], "kernel");
+ i += 1;
fake_preload[i++] = MODINFO_TYPE;
fake_preload[i++] = strlen("elf kernel") + 1;
strcpy((char*)&fake_preload[i++], "elf kernel");
Modified: head/sys/arm/include/pmc_mdep.h
==============================================================================
--- head/sys/arm/include/pmc_mdep.h Wed May 23 13:01:22 2012 (r235830)
+++ head/sys/arm/include/pmc_mdep.h Wed May 23 13:23:40 2012 (r235831)
@@ -54,6 +54,12 @@ union pmc_md_pmc {
#define PMC_TRAPFRAME_TO_FP(TF) ((TF)->tf_usr_lr)
#define PMC_TRAPFRAME_TO_SP(TF) ((TF)->tf_usr_sp)
+/* Build a fake kernel trapframe from current instruction pointer. */
+#define PMC_FAKE_TRAPFRAME(TF) \
+ do { \
+ __asm __volatile("mov %0, pc" : "=r" ((TF)->tf_pc)); \
+ } while (0)
+
/*
* Prototypes
*/
Modified: head/sys/dev/hwpmc/hwpmc_arm.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_arm.c Wed May 23 13:01:22 2012 (r235830)
+++ head/sys/dev/hwpmc/hwpmc_arm.c Wed May 23 13:23:40 2012 (r235831)
@@ -38,38 +38,47 @@ __FBSDID("$FreeBSD$");
struct pmc_mdep *
pmc_md_initialize()
{
+#ifdef CPU_XSCALE_IXP425
if (cpu_class == CPU_CLASS_XSCALE)
return pmc_xscale_initialize();
else
+#endif
return NULL;
}
void
pmc_md_finalize(struct pmc_mdep *md)
{
+#ifdef CPU_XSCALE_IXP425
if (cpu_class == CPU_CLASS_XSCALE)
pmc_xscale_finalize(md);
else
KASSERT(0, ("[arm,%d] Unknown CPU Class 0x%x", __LINE__,
cpu_class));
+#endif
+}
+
+static int
+pmc_save_callchain(uintptr_t *cc, int maxsamples,
+ struct trapframe *tf)
+{
+
+ *cc = PMC_TRAPFRAME_TO_PC(tf);
+ return (1);
}
int
pmc_save_kernel_callchain(uintptr_t *cc, int maxsamples,
struct trapframe *tf)
{
- (void) cc;
- (void) maxsamples;
- (void) tf;
- return (0);
+
+ return pmc_save_callchain(cc, maxsamples, tf);
}
int
pmc_save_user_callchain(uintptr_t *cc, int maxsamples,
struct trapframe *tf)
{
- (void) cc;
- (void) maxsamples;
- (void) tf;
- return (0);
+
+ return pmc_save_callchain(cc, maxsamples, tf);
}
More information about the svn-src-head
mailing list