From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29886 invoked by alias); 15 Dec 2005 08:21:38 -0000 Received: (qmail 29871 invoked by uid 22791); 15 Dec 2005 08:21:35 -0000 X-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_05,UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org Received: from mail4.hitachi.co.jp (HELO mail4.hitachi.co.jp) (133.145.228.5) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 15 Dec 2005 08:21:31 +0000 Received: from mlsv4.hitachi.co.jp (unknown [133.145.228.16]) by mail4.hitachi.co.jp (Postfix) with ESMTP id 7E5C233CC4 for ; Thu, 15 Dec 2005 17:21:28 +0900 (JST) Received: from mfilter-s2.hitachi.co.jp by mlsv4.hitachi.co.jp (8.12.10/8.12.10) id jBF8LVHK031184; Thu, 15 Dec 2005 17:21:31 +0900 Received: from vshuts3.hitachi.co.jp (unverified) by mfilter-s2.hitachi.co.jp (Content Technologies SMTPRS 4.3.17) with SMTP id ; Thu, 15 Dec 2005 17:21:28 +0900 Received: from hsdlgw92.sdl.hitachi.co.jp ([133.144.7.20]) by vshuts3.hitachi.co.jp with SMTP id M2005121517212721983 ; Thu, 15 Dec 2005 17:21:27 +0900 Received: from vgate2.sdl.hitachi.co.jp by hsdlgw92.sdl.hitachi.co.jp (8.9.3/3.7W01100113) id RAA03442; Thu, 15 Dec 2005 17:21:20 +0900 Received: from maila.sdl.hitachi.co.jp ([133.144.14.196]) by vgate2.sdl.hitachi.co.jp (SAVSMTP 3.1.1.32) with SMTP id M2005121517211825609 ; Thu, 15 Dec 2005 17:21:18 +0900 Received: from [192.168.16.226] ([192.168.16.226]) by maila.sdl.hitachi.co.jp (8.13.1/3.7W04031011) with ESMTP id jBF8LJLl006959; Thu, 15 Dec 2005 17:21:19 +0900 Message-ID: <43A12782.5010604@sdl.hitachi.co.jp> Date: Thu, 15 Dec 2005 08:21:00 -0000 From: Masami Hiramatsu User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: ja, en-us, en MIME-Version: 1.0 To: systemtap@sources.redhat.com Cc: Yumiko Sugita , Satoshi Oshima , Hideo Aoki Subject: [SAMPLE][PATCH 1/3]BTI: Binary Transport Interface for SystemTap Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by maila.sdl.hitachi.co.jp id jBF8LJLl006959 X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2005-q4/txt/msg00444.txt.bz2 Hi, I publish Binary Transport Interface (BTI) Patch for SystemTap. This BTI is a concept prototype which was demonstrated in 2nd Face to Face meeting. I attach a core patch of BTI to this mail. But current merge routine of stpd can not handle binary formatted data correctly. So this patch requires another patch which adds an option that prohibits merging to stap, and another merge command. I post it in following mails. I measured the performance number of this BTI and compared with current Ascii Transport Interface (ATI) by using the =93gtodbench=94 gettimeofday micro benchmark on Pentium4 3.06GHz PC. The systemtap script with BTI (*1) has about 1.4 micro secs of processing time. The systemtap script with ATI (*2) has about 4 micro secs of processing time. This performance numbers are including the overhead of kprobes. Also I measured kprobe=92s overhead on the same PC. That was about 1 micro second. So, I expects BTI has very low overhead and is useful for tracing function. (*1) probe kernel.function("sys_gettimeofday") { trace4(1,2,3,4,5); } (*2) probe kernel.function("sys_gettimeofday") { log(string(get_tsc()) . string(get_cpu()) . string(pid()) . string(1)= . string(2). string(3). string(4). string(5)); } But this interface depends strongly on LKST=92s log format. So, I and Satoshi would like to propose another generic BTI format. Best Regards, --=20 Masami HIRAMATSU 2nd Research Dept. Hitachi, Ltd., Systems Development Laboratory E-mail: hiramatu@sdl.hitachi.co.jp Signed-off-by: Masami Hiramatsu runtime/runtime.h | 1 + runtime/trace.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ tapset/tracing.stp | 24 ++++++++++++++++++++++++ 6 files changed, 82 insertions(+), 1 deletion(-) diff -Narup -x CVS a/buildrun.cxx b/buildrun.cxx diff -Narup -x CVS a/runtime/runtime.h b/runtime/runtime.h --- a/runtime/runtime.h 2005-11-29 07:08:39.000000000 +0900 +++ b/runtime/runtime.h 2005-12-05 17:49:59.000000000 +0900 @@ -64,6 +64,7 @@ static struct #include "copy.c" #include "sym.h" #include "alloc.c" +#include "trace.c" /************* Module Stuff ********************/ diff -Narup -x CVS a/runtime/trace.c b/runtime/trace.c --- a/runtime/trace.c 1970-01-01 09:00:00.000000000 +0900 +++ b/runtime/trace.c 2005-12-05 17:49:36.000000000 +0900 @@ -0,0 +1,48 @@ +#ifndef _TRACE_C_ /* -*- linux-c -*- */ +#define _TRACE_C_ + +#include +#include +#include "io.c" + +#define MAX_TRACE_ARGS 16 + +struct stp_trace_entry_head { + unsigned long long tsc; + int num; + int pid; + int cpu; + int type; +}; + +struct stp_trace_entry { + struct stp_trace_entry_head hd; + long args[MAX_TRACE_ARGS]; +}; + +static DEFINE_PER_CPU(struct stp_trace_entry, __trace_entry); + +void _stp_trace (int type, int num, ...) +{ + va_list args; + int cpu =3D smp_processor_id(); + int i; +=09 + struct stp_trace_entry *ent =3D &per_cpu(__trace_entry, cpu); + if (num > MAX_TRACE_ARGS) num =3D MAX_TRACE_ARGS; + ent->hd.cpu =3D cpu; + ent->hd.pid =3D current->pid; + ent->hd.type =3D type; + ent->hd.num =3D num; + va_start(args, num); + for (i =3D 0; i < num; i++) { + ent->args[i] =3D (long)va_arg(args, int64_t); + } + va_end(args); + rdtscll(ent->hd.tsc); + _stp_transport_write(ent, sizeof(struct stp_trace_entry_head) + + num*sizeof(long)); +} + + +#endif /* _TRACE_C_ */ diff -Narup -x CVS a/tapset/tracing.stp b/tapset/tracing.stp --- a/tapset/tracing.stp 1970-01-01 09:00:00.000000000 +0900 +++ b/tapset/tracing.stp 2005-12-05 17:49:36.000000000 +0900 @@ -0,0 +1,24 @@ +// trace_event tapset +// Copyright (C) 2005 Hitachi, Ltd., Systems Development Laboratory +// +// This file is part of systemtap, and is free software. You can +// redistribute it and/or modify it under the terms of the GNU General +// Public License (GPL); either version 2, or (at your option) any +// later version. + +function trace1 (type:long, arg:long) %{ + _stp_trace(THIS->type, 1, THIS->arg); +%} + +function trace2 (type:long, arg1:long, arg2:long) %{ + _stp_trace(THIS->type, 2, THIS->arg1, THIS->arg2); +%} + +function trace3 (type:long, arg1:long, arg2:long, arg3:long) %{ + _stp_trace(THIS->type, 3, THIS->arg1, THIS->arg2, THIS->arg3); +%} + +function trace4 (type:long, arg1:long, arg2:long, arg3:long, arg4:long) %{ + _stp_trace(THIS->type, 4, THIS->arg1, THIS->arg2, THIS->arg3, THIS->arg4); +%} +