Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #8117

Re: Number of times a function is called

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.programming
Subject Re: Number of times a function is called
Date 2017-10-23 00:41 +0100
Organization A noiseless patient Spider
Message-ID <877evmlphq.fsf@bsb.me.uk> (permalink)
References <osj1d6$12nk$1@gioia.aioe.org>

Show all headers | View raw


Victor Porton <porton@narod.ru> writes:

> For debugging purposes,
>
> I need to check that my program calls functions xxx_alloc() and xxx_free() 
> from a (dynamic or static) library the same number of times (every 
> allocation is followed by exactly one deallocation).

If these functions do allocations you might find valgrind useful.

If you want to count the actual calls (without instrumenting the source)
you can use gprof(1) and the -pg flag to gcc.

> How to do this on Linux?

You might get more advice in comp.unix.programmer

-- 
Ben.

Back to comp.programming | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Number of times a function is called Victor Porton <porton@narod.ru> - 2017-10-23 00:08 +0300
  Re: Number of times a function is called Robert Wessel <robertwessel2@yahoo.com> - 2017-10-22 16:19 -0500
  Re: Number of times a function is called Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-10-23 00:41 +0100

csiph-web