From 4c2732a1dad1de295c9219ee3afac007b2d7ba05 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 28 Jan 2009 14:36:08 -0800 Subject: Use 'static' as much as possible This change just inserts 'static' on runtime, tapset, and generated C functions and globals, so the compiler can do a better job of optimizing. My tests with small scripts show ~10% reduction in compile time and ~20% reduction in module size. Larger scripts may show less benefit, but I expect purely positive results. --- runtime/print.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'runtime/print.c') diff --git a/runtime/print.c b/runtime/print.c index 14a0820b..54919876 100644 --- a/runtime/print.c +++ b/runtime/print.c @@ -39,16 +39,16 @@ typedef struct __stp_pbuf { char buf[STP_BUFFER_SIZE]; } _stp_pbuf; -void *Stp_pbuf = NULL; +static void *Stp_pbuf = NULL; /** private buffer for _stp_log() */ #define STP_LOG_BUF_LEN 256 typedef char _stp_lbuf[STP_LOG_BUF_LEN]; -void *Stp_lbuf = NULL; +static void *Stp_lbuf = NULL; /* create percpu print and io buffers */ -int _stp_print_init (void) +static int _stp_print_init (void) { Stp_pbuf = _stp_alloc_percpu(sizeof(_stp_pbuf)); if (unlikely(Stp_pbuf == 0)) @@ -63,7 +63,7 @@ int _stp_print_init (void) return 0; } -void _stp_print_cleanup (void) +static void _stp_print_cleanup (void) { if (Stp_pbuf) _stp_free_percpu(Stp_pbuf); @@ -171,7 +171,7 @@ static void _stp_print_binary (int num, ...) * * @sa _stp_print_flush() */ -void _stp_printf (const char *fmt, ...) +static void _stp_printf (const char *fmt, ...) { int num; va_list args; @@ -207,7 +207,7 @@ void _stp_printf (const char *fmt, ...) * @param str A C string (char *) */ -void _stp_print (const char *str) +static void _stp_print (const char *str) { _stp_pbuf *pb = per_cpu_ptr(Stp_pbuf, smp_processor_id()); char *end = pb->buf + STP_BUFFER_SIZE; @@ -231,7 +231,7 @@ void _stp_print (const char *str) pb->len = ptr - pb->buf; } -void _stp_print_char (const char c) +static void _stp_print_char (const char c) { char *buf; _stp_pbuf *pb = per_cpu_ptr(Stp_pbuf, smp_processor_id()); @@ -274,7 +274,7 @@ static char *next_fmt(char *fmt, int *num) return f; } -void _stp_print_kernel_info(char *vstr, int ctx, int num_probes) +static void _stp_print_kernel_info(char *vstr, int ctx, int num_probes) { #ifdef DEBUG_MEM printk(KERN_DEBUG "%s: systemtap: %s, base: %p, memory: %lu+%lu+%u+%u+%u data+text+ctx+net+alloc, probes: %d\n", -- cgit