1

I am confused as to how to interpret the "Self" slot in QCachegrind. Is it per call cost of a function or is it the total cost of a function when called x times where x is represented by the slot "called"?

(please see the image below)

enter image description here

Is 0.003 the cost of function when called once? or do I need to divide it by 2 ("called" slot) to get the function cost per call?

Marsha
  • 43
  • 3
  • Hi, did you find the answer for this ? I also want to know. – William Jul 24 '19 at 07:00
  • @William : the below answer is supposed to answer. If not, can you explain why you believe the below answer is not correct (or complete or ...) ? – phd Jul 30 '19 at 21:57
  • @phd Please read the OP questions carefully, you do not address OP specific questions about the Self cost, is that cost in the Self is for each call or total cost for 2 "Called" ? I have answered this anyway, look below. – William Aug 01 '19 at 03:31
  • @William Yes, effectively. I was confused by the question, as the question only asks if Self has to be divided, while the same question is also valid for Incl: (and has the same answer). – phd Aug 01 '19 at 21:29

2 Answers2

2

I was also looking for this answer also, found out that the Self that shows 0.003 is the cost for ALL the "Called". So for each call cost, theoretically it cost 0.003 / 2 . Although I think it's not that simple because different call to the same function can have different cost.

William
  • 5,526
  • 6
  • 20
  • 42
  • 1
    Effectively, dividing Self (or Incl) by Called just allows to have an average cost per call : callgrind does not maintain the detailed cost of each call (that would be enormous data for non trivial applications) – phd Aug 01 '19 at 21:31
-1

Incl. is the total cost of the function on that line, including the cost of all the functions called directly or indirectly by this function. Self is the cost of the function itself.

See http://www.valgrind.org/docs/manual/cl-manual.html#cl-manual.use (in particular section 6.1.1. Functionality) for more details.

phd
  • 3,669
  • 1
  • 11
  • 12