# Macro for counting the number of times a function is called?

**URL:** https://discourse.julialang.org/t/macro-for-counting-the-number-of-times-a-function-is-called/3129
**Category:** New to Julia
**Created:** [April 9, 2017, 4:25pm UTC](https://discourse.julialang.org/t/macro-for-counting-the-number-of-times-a-function-is-called/3129 "2017-04-09T16:25:39Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [April 11, 2017, 11:14am UTC](https://discourse.julialang.org/t/macro-for-counting-the-number-of-times-a-function-is-called/3129/6 "2017-04-11T11:14:28Z")

</div>

You don’t need to make the type `<: Function` to work with `map`. Cf a question I asked recently:

> [@Functions and callable methods](https://discourse.julialang.org/t/functions-and-callable-methods/2983):
>
> I am confused about how to organize my code for objects which behave like functions. Some functions do different things when called with arguments which are \<: Function, eg Plots.plot will plot the function, but will not plot a callable object which is not \<: Function (because it can’t dispatch on it, unless a recipe is defined etc). Generally, a type T can have (f::T)(...) methods defined, and T \<: Function can hold. Apparently these two are orthogonal, one can have a \<: Function without i…

---

_[View the full topic](https://discourse.julialang.org/t/macro-for-counting-the-number-of-times-a-function-is-called/3129)._
