diff -burN -X dontdiff linux-2.6.12.2/Makefile linux-2.6.12-ins/Makefile --- linux-2.6.12.2/Makefile 2005-06-29 16:00:53.000000000 -0700 +++ linux-2.6.12-ins/Makefile 2005-07-25 17:24:36.000000000 -0700 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 12 -EXTRAVERSION = .2 +EXTRAVERSION = .2-ins NAME=Woozy Numbat # *DOCUMENTATION* diff -burN -X dontdiff linux-2.6.12.2/include/net/timing.h linux-2.6.12-ins/include/net/timing.h --- linux-2.6.12.2/include/net/timing.h 1969-12-31 16:00:00.000000000 -0800 +++ linux-2.6.12-ins/include/net/timing.h 2005-07-25 17:26:25.000000000 -0700 @@ -0,0 +1,14 @@ +#ifndef _TIMING_H +#define _TIMING_H + +#define tsc(hi,lo) __asm__ __volatile__ ("rdtsc" : "=A" (lo), "=D" (hi)) + +struct tsc_reg { + long hi; + long lo; +}; + +extern struct tsc_reg inst_start; +extern struct sk_buff* inst_curpkt; + +#endif /* _TIMING_H */ diff -burN -X dontdiff linux-2.6.12.2/net/core/dev.c linux-2.6.12-ins/net/core/dev.c --- linux-2.6.12.2/net/core/dev.c 2005-06-29 16:00:53.000000000 -0700 +++ linux-2.6.12-ins/net/core/dev.c 2005-08-01 17:41:29.000000000 -0700 @@ -115,6 +115,19 @@ #endif /* CONFIG_NET_RADIO */ #include +/* Kernel Instrumentation */ +#ifndef TIMING +#define TIMING +#endif + +#ifdef TIMING +#include +struct sk_buff* inst_curpkt = NULL; /* Packet to be traced */ +int inst_reset = 0; /* Used to reset the tracing */ +struct tsc_reg inst_start; +struct tsc_reg prev_time; +#endif /* TIMING */ + /* This define, if set, will randomly drop a packet when congestion * is more than moderate. It helps fairness in the multi-interface * case when one of them is a hog, but it kills performance for the @@ -1452,6 +1465,38 @@ struct softnet_data *queue; unsigned long flags; +#ifdef TIMING + /* Packet Timing Instrumentation */ + struct tsc_reg prev_time, cur_time; + prev_time.hi = 0; cur_time.hi = 0; + + if (prev_time.hi == 0) { + tsc(prev_time.hi, prev_time.lo); + } else { + tsc(cur_time.hi, cur_time.lo); + __u32 diff = cur_time.lo - prev_time.lo; + printk(KERN_INFO "Diff=%u\n", diff); + prev_time = cur_time; + } + +#if 0 + if (inst_curpkt != NULL && inst_reset > 0) { + printk(KERN_INFO "sk_buff %x: Timing RESET\n", (unsigned) skb); + inst_curpkt = NULL; + inst_start.hi = 0; + inst_start.lo = 0; + } + + if (inst_curpkt == NULL) { + printk(KERN_INFO "sk_buff %x: Start trace", (unsigned) skb); + inst_curpkt = skb; + tsc(inst_start.hi, inst_start.lo); + inst_reset = 0; + } +#endif + /* Packet Timing Instrumentation */ +#endif + /* if netpoll wants it, pretend we never saw it */ if (netpoll_rx(skb)) return NET_RX_DROP; @@ -1792,6 +1837,19 @@ unsigned long start_time = jiffies; int budget = netdev_max_backlog; +#ifdef TIMING + /* Packet Timing Instrumentation */ + struct tsc_reg cur_time; + + if (prev_time.hi == 0) { + tsc(prev_time.hi, prev_time.lo); + } else { + tsc(cur_time.hi, cur_time.lo); + __u32 diff = cur_time.lo - prev_time.lo; + printk(KERN_INFO "Diff=%u\n", diff); + prev_time = cur_time; + } +#endif local_irq_disable(); diff -burN -X dontdiff linux-2.6.12.2/net/ipv4/ip_input.c linux-2.6.12-ins/net/ipv4/ip_input.c --- linux-2.6.12.2/net/ipv4/ip_input.c 2005-06-29 16:00:53.000000000 -0700 +++ linux-2.6.12-ins/net/ipv4/ip_input.c 2005-07-25 17:55:21.000000000 -0700 @@ -146,6 +146,15 @@ #include #include +/* Kernel Instrumentation */ +#ifndef TIMING +#define TIMING +#endif + +#ifdef TIMING +#include +#endif + /* * SNMP management statistics */ @@ -361,6 +370,19 @@ { struct iphdr *iph; +#if 0 +#ifdef TIMING + /* Packet Timing Instrumentation */ + if (inst_curpkt != NULL) { + struct tsc_reg cur_time; + tsc(cur_time.hi, cur_time.lo); + printk(KERN_INFO "sk_buff %x: ip_input after %lu usecs\n", + (unsigned) skb, + (__u32) cur_time.lo - inst_start.lo); + } +#endif /* TIMING */ +#endif + /* When the interface is in promisc. mode, drop all the crap * that it receives, do not try to analyse it. */ diff -burN -X dontdiff linux-2.6.12.2/net/ipv4/udp.c linux-2.6.12-ins/net/ipv4/udp.c --- linux-2.6.12.2/net/ipv4/udp.c 2005-06-29 16:00:53.000000000 -0700 +++ linux-2.6.12-ins/net/ipv4/udp.c 2005-07-25 17:55:55.000000000 -0700 @@ -108,6 +108,15 @@ #include #include +/* Kernel Intrumentation */ +#ifndef TIMING +#define TIMING +#endif + +#ifdef TIMING +#include +#endif + /* * Snmp MIB for the UDP layer */ @@ -1133,6 +1142,19 @@ if (!pskb_may_pull(skb, sizeof(struct udphdr))) goto no_header; +#if 0 +#ifdef TIMING + /* Packet Timing Instrumentation */ + if (inst_curpkt != NULL) { + struct tsc_reg cur_time; + tsc(cur_time.hi, cur_time.lo); + printk(KERN_INFO "sk_buff %x: udp_input after %lu usecs\n", + (unsigned) skb, + (__u32) cur_time.lo - inst_start.lo); + } +#endif /* TIMING */ +#endif + uh = skb->h.uh; ulen = ntohs(uh->len);