[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56A07FF3.2090009@huawei.com>
Date: Thu, 21 Jan 2016 14:51:31 +0800
From: "Wangnan (F)" <wangnan0@...wei.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
CC: <peterz@...radead.org>, <ast@...nel.org>,
<linux-kernel@...r.kernel.org>, He Kuang <hekuang@...wei.com>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Brendan Gregg <brendan.d.gregg@...il.com>,
Jiri Olsa <jolsa@...nel.org>,
Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
Namhyung Kim <namhyung@...nel.org>,
Zefan Li <lizefan@...wei.com>, <pi3orama@....com>
Subject: Re: [PATCH 0/6] perf core: Read from overwrite ring buffer
On 2016/1/20 10:20, Alexei Starovoitov wrote:
> On Wed, Jan 20, 2016 at 09:37:42AM +0800, Wangnan (F) wrote:
>>
>> On 2016/1/20 1:42, Alexei Starovoitov wrote:
>>> On Tue, Jan 19, 2016 at 11:16:44AM +0000, Wang Nan wrote:
>>>> This patchset introduces two methods to support reading from overwrite.
>>>>
>>>> 1) Tailsize: write the size of an event at the end of it
>>>> 2) Backward writing: write the ring buffer from the end of it to the
>>>> beginning.
>>> what happend with your other idea of moving the whole header to the end?
>>> That felt better than either of these options.
>> I'll try it today. However, putting all of the three together is
>> not as easy as this patchset.
> I'm missing something. Why all three in one set?
Can't implement all three in one, but implement two of them make
benchmarking simpler :)
Here comes some numbers.
I attach a target program at the end of this mail. It calls
close(-1) for 3000000 times, and use gettimeofday to check
how many us it takes.
Following cases are tested:
BASE : ./a.out
RAWPERF : ./perf record -o /dev/null -e raw_syscalls:* ./a.out
WRTBKWRD: ./perf record -o /dev/null -e raw_syscalls:* ./a.out
TAILSIZE: ./perf record --no-has-write-backward -o /dev/null -e
raw_syscalls:*/overwrite/ ./a.out
RAWOVWRT: ./perf record --no-has-write-backward --no-has-tailsize -o
/dev/null -e raw_syscalls:*/overwrite/ ./a.out
With this script:
func() {
for x in `seq 1 100` ; do $1; done | tee data_$2
}
func ./a.out base
func "./perf record -o /dev/null -e raw_syscalls:* ./a.out" rawperf
func "./perf record -o /dev/null -e raw_syscalls:*/overwrite/ ./a.out"
wrtbkwrd
func "./perf record -o /dev/null --no-has-write-backward -e
raw_syscalls:*/overwrite/ ./a.out" tailsize
func "./perf record -o /dev/null --no-has-write-backward
--no-has-tailsize -o /dev/null -e raw_syscalls:*/overwrite/ ./a.out"
rawovwrt
Result:
MEAN STDVAR
BASE : 879870.81 11913.13
RAWPERF : 2603854.7 706658.4
WRTBKWRD: 2313301.220 6727.957
TAILSIZE: 2383051.860 5248.061
RAWOVWRT: 2315273.180 5221.025
So it seems backward writing methods is good enough. We don't need to
consider
tailsize method.
Code for this benchmark can be found from:
https://git.kernel.org/cgit/linux/kernel/git/pi3orama/linux.git/
perf/overwrite-benchmark
Thank you.
-------- Test program ----------
#include <unistd.h>
#include <fcntl.h>
#include <sys/time.h>
#include <stdio.h>
int main()
{
int i;
struct timeval tv1, tv2;
long long us1, us2;
gettimeofday(&tv1, NULL);
for (i = 0; i < 1000 * 1000 * 3; i++) {
close(-1);
}
gettimeofday(&tv2, NULL);
us1 = tv1.tv_sec * 1000000 + tv1.tv_usec;
us2 = tv2.tv_sec * 1000000 + tv2.tv_usec;
printf("%ld\n", us2 - us1);
return 0;
}
Powered by blists - more mailing lists