namhyung / uftrace

Function graph tracer for C/C++/Rust/Python
https://uftrace.github.io/slide/
GNU General Public License v2.0
3.04k stars 473 forks source link

c++ tracing error #303

Open ghost opened 6 years ago

ghost commented 6 years ago

I've been able to record the trace but when I try to graph it I got the error: uftrace: cannot find graph for 'main' The report also looks odd:

  Total time   Self time       Calls  Function
  ==========  ==========  ==========  ====================================
    1.461 us    1.461 us           1  gprs_rlcmac_ts_alloc.cpp
    0.440 us    0.440 us           1  sba.cpp
    0.246 us    0.246 us           1  SBAController::SBAController
    0.173 us    0.173 us           1  tbf.cpp
    0.165 us    0.165 us           1  tbf_dl.cpp
    0.161 us    0.161 us           1  gprs_ms.cpp
    0.138 us    0.138 us           1  tbf_ul.cpp
    0.138 us    0.138 us           1  gprs_rlcmac_sched.cpp

The file names are used instead of functions. For .c project it works as expected. Is there something special required for .cpp?

namhyung commented 6 years ago

Hi, thanks for using uftrace. There should be nothing special for C++ programs. Could you please show me the output of uftrace info?

ghost commented 6 years ago
# system information
# ==================
# program version     : uftrace v0.6.2
# recorded on         : Thu Dec 28 14:15:10 2017
# cmdline             : uftrace record ./src/osmo-pcu -c /home/max/.config/osmocom/osmo-pcu.cfg-edge 
# cpu info            : Intel(R) Core(TM) i5 CPU       U 470  @ 1.33GHz
# number of cpus      : 4 / 4 (online / possible)
# memory info         : 0.1 / 3.5 GB (free / total)
# system load         : 0.98 / 0.93 / 0.74 (1 / 5 / 15 min)
# kernel version      : Linux 4.13.0-22-lowlatency
# hostname            : pbell
# distro              : "Ubuntu 17.10"
#
# process information
# ===================
# number of tasks     : 1
# task list           : 10509
# exe image           : /home/max/source/gsm/osmo-pcu/src/osmo-pcu
# build id            : bf89626396c53e057b298260e394be6c0e22ad9e
# exit status         : unknown exit status: -1
# cpu time            : 0.000 / 0.000 sec (sys / user)
# context switch      : 0 / 0 (voluntary / involuntary)
# max rss             : 0 KB
# page fault          : 0 / 0 (major / minor)
# disk iops           : 0 / 0 (read / write)

To add support for uftrace I've added -pg for project's CFLAGS and CPPFLAGS. Should I add some linker options as well?

namhyung commented 6 years ago

No, it should be enough. But your uftrace version is old, is it possible for you to build from latest source? You need to install libelf-dev package.

ghost commented 6 years ago

Is there some ppa available? The repo does not have debian/ so building .deb would require combining ubuntu's packaging with latest master or release.

honggyukim commented 6 years ago

Hi @osmoc, You better follow the quick install guide from source file. https://github.com/namhyung/uftrace/blob/master/INSTALL.md#quick-guide

kecsap commented 6 years ago

@osmoc I uploaded a packaged version to my PPA for Ubuntu Xenial: https://launchpad.net/~csaba-kertesz/+archive/ubuntu/random/

ghost commented 6 years ago

@kecsap cool, thanks. Unfortunately I'm using artful (ubuntu 17.10).

kecsap commented 6 years ago

I think you can just download the package and install. I don't think it should be incompatible. I usually download, install packages (C++ tools) from later Ubuntu releases and install on Xenial without any usability problem.