+}
+
+INLINE void led_on(void)
+{
+ GPIO_PORTG_DATA_R |= 0x04;
+}
+
+INLINE void led_off(void)
+{
+ GPIO_PORTG_DATA_R &= ~0x04;
+}
+
+INLINE hptime_t get_hp_ticks(void)
+{
+ return (TIMER_HW_CNT - timer_hw_hpread()) +
+ timer_clock_unlocked() * TIMER_HW_CNT;
+}
+
+#if CONFIG_KERN_HEAP
+#define hp_stack NULL
+#define HP_STACK_SIZE KERN_MINSTACKSIZE * 2
+#else
+static PROC_DEFINE_STACK(hp_stack, KERN_MINSTACKSIZE * 2);
+#define HP_STACK_SIZE sizeof(hp_stack)
+#endif
+
+static void NORETURN hp_process(void)
+{
+ char spinner[] = {'/', '-', '\\', '|'};
+ int i;
+
+ for(i = 0; ; i++)
+ {
+ sig_wait(SIG_USER0);
+ end = get_hp_ticks();
+ kprintf("%c context switch in %lu clock cycles (~%lu us) \r",
+ spinner[i % countof(spinner)],
+ end - start,
+ ((end - start) * 1000000 / CPU_FREQ));
+ led_off();
+ timer_delay(50);
+ sig_send(lp_proc, SIG_USER0);
+ }
+}