Microstate Accounting: Track time in system calls and interrupts, i386 code.

Signed-off-by; Peter Chubb <[EMAIL PROTECTED]>

 arch/i386/kernel/entry.S |   16 ++++++++++++++++
 arch/i386/kernel/irq.c |   13 ++++++++++++-


Index: linux-2.6-ustate/arch/i386/kernel/entry.S
===================================================================
--- linux-2.6-ustate.orig/arch/i386/kernel/entry.S      2005-03-10 
09:13:01.448604031 +1100
+++ linux-2.6-ustate/arch/i386/kernel/entry.S   2005-03-10 09:16:14.888575341 
+1100
@@ -222,10 +222,18 @@
        /* Note, _TIF_SECCOMP is bit number 8, and so it needs testw and not 
testb */
        testw 
$(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),TI_flags(%ebp)
        jnz syscall_trace_entry
+#ifdef CONFIG_MICROSTATE
+       pushl   %eax
+       call msa_start_syscall
+       popl    %eax
+#endif
        cmpl $(nr_syscalls), %eax
        jae syscall_badsys
        call *sys_call_table(,%eax,4)
        movl %eax,EAX(%esp)
+#ifdef CONFIG_MICROSTATE
+       call msa_end_syscall
+#endif
        cli
        movl TI_flags(%ebp), %ecx
        testw $_TIF_ALLWORK_MASK, %cx
@@ -250,9 +258,17 @@
        cmpl $(nr_syscalls), %eax
        jae syscall_badsys
 syscall_call:
+#ifdef CONFIG_MICROSTATE
+       pushl   %eax
+       call msa_start_syscall
+       popl    %eax
+#endif
        call *sys_call_table(,%eax,4)
        movl %eax,EAX(%esp)             # store the return value
 syscall_exit:
+#ifdef CONFIG_MICROSTATE
+       call msa_end_syscall
+#endif
        cli                             # make sure we don't miss an interrupt
                                        # setting need_resched or sigpending
                                        # between sampling and the iret


Index: linux-2.6-ustate/arch/i386/kernel/irq.c
===================================================================
--- linux-2.6-ustate.orig/arch/i386/kernel/irq.c        2005-03-10 
09:13:00.115606274 +1100
+++ linux-2.6-ustate/arch/i386/kernel/irq.c     2005-03-10 09:16:16.032121680 
+1100
@@ -55,6 +55,8 @@
 #endif
 
        irq_enter();
+       msa_start_irq(irq);
+       
 #ifdef CONFIG_DEBUG_STACKOVERFLOW
        /* Debugging check for stack overflow: is there less than 1KB free? */
        {
@@ -101,6 +103,7 @@
 #endif
                __do_IRQ(irq, regs);
 
+       msa_finish_irq(irq);
        irq_exit();
 
        return 1;
@@ -221,10 +224,18 @@
                seq_printf(p, "%3d: ",i);
 #ifndef CONFIG_SMP
                seq_printf(p, "%10u ", kstat_irqs(i));
+#ifdef CONFIG_MICROSTATE
+               seq_printf(p, "%10llu", msa_irq_time(0, i));
+#endif
 #else
                for (j = 0; j < NR_CPUS; j++)
-                       if (cpu_online(j))
+                       if (cpu_online(j)) {
                                seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
+#ifdef CONFIG_MICROSTATE
+                               seq_printf(p, "%10llu", msa_irq_time(j, i));
+#endif
+                       }
+
 #endif
                seq_printf(p, " %14s", irq_desc[i].handler->typename);
                seq_printf(p, "  %s", action->name);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to