summaryrefslogtreecommitdiff
path: root/net/socket.c
diff options
context:
space:
mode:
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>2011-03-16 19:04:29 -0400
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>2011-03-16 19:04:29 -0400
commit9b827e2545a7ef851246dc60aade9454c1fd63a8 (patch)
tree814a0fb4a8170a4cae06bda0429944cc91bff5c7 /net/socket.c
parent29f552b77e4b67e3f40f2b508289fd4a72adf03e (diff)
lttng-instrumentation/lttng-instrumentation-socket
LTTng instrumentation - socket Instrument socket creation and activity (msg send, receive). Socket "call" instrumentation should be completed. Those tracepoints are used by LTTng. About the performance impact of tracepoints (which is comparable to markers), even without immediate values optimizations, tests done by Hideo Aoki on ia64 show no regression. His test case was using hackbench on a kernel where scheduler instrumentation (about 5 events in code scheduler code) was added. See the "Tracepoints" patch header for performance result detail. Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> CC: netdev@vger.kernel.org CC: David S. Miller <davem@davemloft.net> CC: Masami Hiramatsu <mhiramat@redhat.com> CC: 'Peter Zijlstra' <peterz@infradead.org> CC: "Frank Ch. Eigler" <fche@redhat.com> CC: 'Ingo Molnar' <mingo@elte.hu> CC: 'Hideo AOKI' <haoki@redhat.com> CC: Takashi Nishiie <t-nishiie@np.css.fujitsu.com> CC: 'Steven Rostedt' <rostedt@goodmis.org> CC: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/net/socket.c b/net/socket.c
index ac2219f90d5..319a3b8f241 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -98,6 +98,7 @@
#include <net/sock.h>
#include <linux/netfilter.h>
+#include <trace/socket.h>
#include <linux/if_tun.h>
#include <linux/ipv6_route.h>
@@ -164,6 +165,11 @@ static const struct net_proto_family __rcu *net_families[NPROTO] __read_mostly;
static DEFINE_PER_CPU(int, sockets_in_use);
+DEFINE_TRACE(socket_sendmsg);
+DEFINE_TRACE(socket_recvmsg);
+DEFINE_TRACE(socket_create);
+DEFINE_TRACE(socket_call);
+
/*
* Support routines.
* Move socket addresses back and forth across the kernel/user
@@ -578,6 +584,7 @@ int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
ret = __sock_sendmsg(&iocb, sock, msg, size);
if (-EIOCBQUEUED == ret)
ret = wait_on_sync_kiocb(&iocb);
+ trace_socket_sendmsg(sock, msg, size, ret);
return ret;
}
EXPORT_SYMBOL(sock_sendmsg);
@@ -714,6 +721,7 @@ int sock_recvmsg(struct socket *sock, struct msghdr *msg,
ret = __sock_recvmsg(&iocb, sock, msg, size, flags);
if (-EIOCBQUEUED == ret)
ret = wait_on_sync_kiocb(&iocb);
+ trace_socket_recvmsg(sock, msg, size, flags, ret);
return ret;
}
EXPORT_SYMBOL(sock_recvmsg);
@@ -1314,6 +1322,7 @@ SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol)
if (retval < 0)
goto out_release;
+ trace_socket_create(sock, retval);
out:
/* It may be already another descriptor 8) Not kernel problem. */
return retval;
@@ -2249,6 +2258,8 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args)
a0 = a[0];
a1 = a[1];
+ trace_socket_call(call, a0);
+
switch (call) {
case SYS_SOCKET:
err = sys_socket(a0, a1, a[2]);