summaryrefslogtreecommitdiffstats
path: root/tapset
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-01-28 14:36:08 -0800
committerJosh Stone <jistone@redhat.com>2009-01-28 17:16:50 -0800
commit4c2732a1dad1de295c9219ee3afac007b2d7ba05 (patch)
treefb84977ad73f62ce57a147e9c3d6bf869376737c /tapset
parent83e08fc5458e8196d5f0ed5790f9f7de77a80bb6 (diff)
downloadsystemtap-steved-4c2732a1dad1de295c9219ee3afac007b2d7ba05.tar.gz
systemtap-steved-4c2732a1dad1de295c9219ee3afac007b2d7ba05.tar.xz
systemtap-steved-4c2732a1dad1de295c9219ee3afac007b2d7ba05.zip
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.
Diffstat (limited to 'tapset')
-rw-r--r--tapset/aux_syscalls.stp22
-rw-r--r--tapset/errno.stp4
-rw-r--r--tapset/nfs_proc.stp20
3 files changed, 23 insertions, 23 deletions
diff --git a/tapset/aux_syscalls.stp b/tapset/aux_syscalls.stp
index 603d2158..42b2abf8 100644
--- a/tapset/aux_syscalls.stp
+++ b/tapset/aux_syscalls.stp
@@ -1419,7 +1419,7 @@ typedef struct {
char *name;
} _stp_val_array;
-void _stp_lookup_str(const _stp_val_array * const array, long val, char *ptr, int len)
+static void _stp_lookup_str(const _stp_val_array * const array, long val, char *ptr, int len)
{
int i = 0, slen;
while (array[i].name) {
@@ -1432,7 +1432,7 @@ void _stp_lookup_str(const _stp_val_array * const array, long val, char *ptr, in
slen = strlen(ptr);
_stp_snprintf(ptr + slen, len - slen, "0x%lx", val);
}
-void _stp_lookup_or_str(const _stp_val_array * const array, long val, char *ptr, int len)
+static void _stp_lookup_or_str(const _stp_val_array * const array, long val, char *ptr, int len)
{
int i = 0, flag = 0, slen;
@@ -1461,7 +1461,7 @@ void _stp_lookup_or_str(const _stp_val_array * const array, long val, char *ptr,
%}
%{
-const _stp_val_array const _stp_signal_list[] = {
+static const _stp_val_array const _stp_signal_list[] = {
{0, "SIG_0"},
V(SIGHUP),
V(SIGINT),
@@ -1493,7 +1493,7 @@ const _stp_val_array const _stp_signal_list[] = {
{0, NULL}
};
-void _stp_sigset_str(sigset_t *mask, char *ptr, int len)
+static void _stp_sigset_str(sigset_t *mask, char *ptr, int len)
{
const _stp_val_array * const array = _stp_signal_list;
int i = 0, flag = 0;
@@ -1517,7 +1517,7 @@ function _signal_name:string(sig:long)
%}
%{
-const _stp_val_array const _stp_semctl_list[] = {
+static const _stp_val_array const _stp_semctl_list[] = {
V(IPC_INFO),
V(SEM_INFO),
V(SEM_STAT),
@@ -1556,7 +1556,7 @@ function _stp_sigset_u:string(setptr:long)
%}
%{
-const _stp_val_array const _stp_fork_list[] = {
+static const _stp_val_array const _stp_fork_list[] = {
V(CLONE_VM),
V(CLONE_FS),
V(CLONE_FILES),
@@ -1604,7 +1604,7 @@ function __fork_flags:string(flags:long)
%}
%{
-const _stp_val_array const _stp_atflag_list[] = {
+static const _stp_val_array const _stp_atflag_list[] = {
#ifdef AT_SYMLINK_NOFOLLOW
V(AT_SYMLINK_NOFOLLOW),
#endif
@@ -1626,7 +1626,7 @@ function _at_flag_str:string(f:long)
%{
#include <linux/shm.h>
-const _stp_val_array const _stp_shmat_list[] = {
+static const _stp_val_array const _stp_shmat_list[] = {
V(SHM_RDONLY),
V(SHM_RND),
V(SHM_REMAP),
@@ -1643,7 +1643,7 @@ function _shmat_flags_str:string(f:long)
%{
#include <linux/mman.h>
-const _stp_val_array const _stp_mprotect_list[] = {
+static const _stp_val_array const _stp_mprotect_list[] = {
{0, "PROT_NONE"},
V(PROT_READ),
V(PROT_WRITE),
@@ -1660,7 +1660,7 @@ function _mprotect_prot_str:string(prot:long)
%{
#include <linux/mman.h>
-const _stp_val_array const _stp_mmap_list[] = {
+static const _stp_val_array const _stp_mmap_list[] = {
V(MAP_SHARED),
V(MAP_PRIVATE),
V(MAP_FIXED),
@@ -1730,7 +1730,7 @@ function _sighandler_str:string(uaddr:long)
%}
%{
-void _stp_sigaction_str(struct sigaction *act, char *ptr, int len)
+static void _stp_sigaction_str(struct sigaction *act, char *ptr, int len)
{
static const _stp_val_array const _stp_sa_handler_list[] = {
{0, "SIG_DFL"},
diff --git a/tapset/errno.stp b/tapset/errno.stp
index 2523d846..eda9bff1 100644
--- a/tapset/errno.stp
+++ b/tapset/errno.stp
@@ -9,7 +9,7 @@
%{
#define N(a) [a]=#a
-const char * const errlist[] = {
+static const char * const errlist[] = {
/* from asm-generic/errno-base.h */
[1] = "EPERM",
[2] = "ENOENT",
@@ -340,7 +340,7 @@ const char * const errlist[] = {
#endif
};
#undef N
-const int Maxerrno = sizeof(errlist)/sizeof(char *);
+static const int Maxerrno = sizeof(errlist)/sizeof(char *);
%}
function errno_str:string (err:long) %{ /* pure */
diff --git a/tapset/nfs_proc.stp b/tapset/nfs_proc.stp
index 4f841836..11463e9a 100644
--- a/tapset/nfs_proc.stp
+++ b/tapset/nfs_proc.stp
@@ -5,18 +5,18 @@
%{
/*Get rpc_clnt from inode, same as kernel function NFS_CLIENT*/
- struct rpc_clnt *_stap_NFS_CLIENT(struct inode *inode, struct context * __restrict__ c);
+ static struct rpc_clnt *_stap_NFS_CLIENT(struct inode *inode, struct context * __restrict__ c);
/*Get ip address from a rpc_clnt*/
- __u32 _get_ip_from_client(struct rpc_clnt *clnt, struct context * __restrict__ c);
+ static __u32 _get_ip_from_client(struct rpc_clnt *clnt, struct context * __restrict__ c);
/*Get protocol types from a rpc_clnt*/
- int _get_prot_from_client(struct rpc_clnt *clnt, struct context * __restrict__ c);
+ static int _get_prot_from_client(struct rpc_clnt *clnt, struct context * __restrict__ c);
/*Get ip address from a rpc_task*/
- __u32 get_ip(struct rpc_task *, struct context * __restrict__);
+ static __u32 get_ip(struct rpc_task *, struct context * __restrict__);
/*Get protocol types from a rpc_task*/
- int get_prot(struct rpc_task *, struct context * __restrict__);
+ static int get_prot(struct rpc_task *, struct context * __restrict__);
%}
%{
- struct rpc_clnt *_stap_NFS_CLIENT(struct inode *inode, struct context * __restrict__ c) {
+ static struct rpc_clnt *_stap_NFS_CLIENT(struct inode *inode, struct context * __restrict__ c) {
struct super_block *i_sb;
struct nfs_server *server;
i_sb = kread(&(inode->i_sb));
@@ -26,7 +26,7 @@
return NULL;
}
- __u32 _get_ip_from_client(struct rpc_clnt *clnt, struct context * __restrict__ c) {
+ static __u32 _get_ip_from_client(struct rpc_clnt *clnt, struct context * __restrict__ c) {
struct rpc_xprt * cl_xprt;
struct sockaddr_in *addr;
cl_xprt= kread(&(clnt->cl_xprt));
@@ -39,7 +39,7 @@
return -1;
}
- int _get_prot_from_client(struct rpc_clnt *clnt, struct context * __restrict__ c) {
+ static int _get_prot_from_client(struct rpc_clnt *clnt, struct context * __restrict__ c) {
struct rpc_xprt * cl_xprt;
cl_xprt= kread(&(clnt->cl_xprt));
return kread(&(cl_xprt->prot));
@@ -47,7 +47,7 @@
return -1;
}
- __u32 get_ip(struct rpc_task * task, struct context * __restrict__ c) {
+ static __u32 get_ip(struct rpc_task * task, struct context * __restrict__ c) {
struct rpc_clnt * clnt;
clnt = kread(&(task->tk_client));
return _get_ip_from_client(clnt, c);
@@ -55,7 +55,7 @@
return -1;
}
- int get_prot(struct rpc_task * task, struct context * __restrict__ c) {
+ static int get_prot(struct rpc_task * task, struct context * __restrict__ c) {
struct rpc_clnt * clnt;
clnt = kread(&(task->tk_client));
return _get_prot_from_client(clnt, c);