Skip to content

Instantly share code, notes, and snippets.

@kylelemons
Forked from anonymous/client_cpp.txt
Created June 6, 2013 04:55
Show Gist options
  • Save kylelemons/5719397 to your computer and use it in GitHub Desktop.
Save kylelemons/5719397 to your computer and use it in GitHub Desktop.
Analysis for http://golang.org/issue/5643 on darwin/amd64.
$ time ./client_cpp
real 1m48.071s
user 0m1.955s
sys 1m45.919s
# ./trace.d
dtrace: script './trace.d' matched 22 probes
CPU ID FUNCTION:NAME
2 1 :BEGIN Tracing...
0 1599 kco_ma_addsample:exec ./server_cpp process starting
3 1599 kco_ma_addsample:exec ./client_cpp process starting
1 1596 exit1:exit server_cpp process exiting 1
2 1596 exit1:exit client_cpp process exiting 1
^C
0 2 :END Summary:
server_cpp write_nocancel
value ------------- Distribution ------------- count
4 | 0
8 |@@@@@@@@@@@@@ 1
16 |@@@@@@@@@@@@@ 1
32 |@@@@@@@@@@@@@ 1
64 | 0
server_cpp recvfrom
value ------------- Distribution ------------- count
-1 | 0
0 | 1
1 | 0
2 |@@@@@@@@@@@@@@@@@ 2406802
4 |@@@@@@@@@@@@@@@@@@@@@@@ 3275080
8 | 12043
16 | 4013
32 | 2165
64 | 798
128 | 443
256 | 86
512 | 30
1024 | 22
2048 | 0
client_cpp sendto
value ------------- Distribution ------------- count
1 | 0
2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10000000
4 | 0
$ time ./client_go --nodelay=false
real 2m5.117s
user 0m11.349s
sys 1m53.571s
# ./trace.d
dtrace: script './trace.d' matched 22 probes
CPU ID FUNCTION:NAME
1 1 :BEGIN Tracing...
0 1599 kco_ma_addsample:exec ./server_cpp process starting
1 1599 kco_ma_addsample:exec ./client_go process starting
0 1596 exit1:exit server_cpp process exiting 1
2 1596 exit1:exit client_go process exiting 1
^C
3 2 :END Summary:
client_go read
value ------------- Distribution ------------- count
16 | 0
32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
64 | 0
server_cpp write_nocancel
value ------------- Distribution ------------- count
4 | 0
8 |@@@@@@@@@@@@@ 1
16 |@@@@@@@@@@@@@ 1
32 |@@@@@@@@@@@@@ 1
64 | 0
server_cpp recvfrom
value ------------- Distribution ------------- count
-1 | 0
0 | 1
1 | 0
2 |@@@@@@@@@@@@@@@@@@@@@@@ 3798634
4 |@@@@@@@@@@@@@@@@@ 2926728
8 | 8887
16 | 3438
32 | 1932
64 | 633
128 | 373
256 | 167
512 | 104
1024 | 37
2048 | 0
client_go write
value ------------- Distribution ------------- count
1 | 0
2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10000000
4 | 0
$ time ./client_go --nodelay=true
real 2m48.513s
user 0m12.503s
sys 2m35.810s
# ./trace.d
dtrace: script './trace.d' matched 22 probes
CPU ID FUNCTION:NAME
2 1 :BEGIN Tracing...
2 1599 kco_ma_addsample:exec ./server_cpp process starting
1 1599 kco_ma_addsample:exec ./client_go process starting
0 1596 exit1:exit server_cpp process exiting 1
1 1596 exit1:exit client_go process exiting 1
^C
0 2 :END Summary:
client_go read
value ------------- Distribution ------------- count
16 | 0
32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
64 | 0
server_cpp write_nocancel
value ------------- Distribution ------------- count
4 | 0
8 |@@@@@@@@@@@@@ 1
16 |@@@@@@@@@@@@@ 1
32 |@@@@@@@@@@@@@ 1
64 | 0
server_cpp recvfrom
value ------------- Distribution ------------- count
-1 | 0
0 | 1
1 | 0
2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9705811
4 | 71616
8 | 14109
16 | 2711
32 | 953
64 | 285
128 | 87
256 | 25
512 | 7
1024 | 4
2048 | 0
client_go write
value ------------- Distribution ------------- count
1 | 0
2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10000000
4 | 0
#!/usr/sbin/dtrace -s
/* http://www.tablespace.net/quicksheet/dtrace-quickstart.html */
dtrace:::BEGIN
{
printf("Tracing...\n");
}
proc:::exec
/args[0] == "./server_cpp" || args[0] == "./client_cpp" || args[0] == "./client_go"/
{
printf("%s process starting", args[0]);
}
proc:::exit
/execname == "server_cpp" || execname == "client_cpp" || execname == "client_go"/
{
printf("%s process exiting %d", execname, args[0]);
}
syscall::read*:return, syscall::write*:return,
syscall::send*:return, syscall::recv*:return
/execname == "server_cpp" || execname == "client_cpp" || execname == "client_go"/
{
@Sizes[execname, probefunc] = quantize(arg0);
}
END
{
printf("Summary:");
printa(@Sizes);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment