I have an open source C/C++ program on Linux amd64 that processes a PDF input file and that I did not write by myself. So I'm not familiar with its code.
I've already ruled out the hypothesis my Samba setup being that slow in general because the performance of other applications is fine, including Firefox, LibreOffice and things like cp or sha1sum reading files from the share very quickly.
It must be something in the C/C++ program that maybe suffers seriously from the high latency, maybe because it causes a Samba server roundtrip for every single byte or whatever.
I've run
valgrind --tool=callgrind ./myprogram /sambasrv/share/myfile.pdf
and tried to interpret its output with kcachegrind.
But nothing special caught my eye. I would have expected a certain call to be huge where it spends all the time waiting for the network. But maybe I'm looking at the wrong things.
How would you investigate in what method all the execution time of about a minute is spent?
Unfortunately, I haven't used Valgrind until today. So please excuse my newbie question.
By default, callgrind will only capture instructions being executed. If you want to look at the time taken by system call, you should add the following option;
--collect-systime=no|yes|msec|usec|nsec Collect system call time info? [no]
no Do not collect system call time info.
msec|yes Collect syscount, syscall elapsed time (milli-seconds).
usec Collect syscount, syscall elapsed time (micro-seconds).
nsec Collect syscount, syscall elapsed and syscall cpu time (nano-seconds).
If you do not specify it, the default value for this option is "no" (as indicated at the end of the first line).
Once you have selected the above, kcachegrind will allow you to look at system calls related information such as elapsed time spent in the system call.