For built-in functions we may use the Villegas-Gayley trick:
TanhBag = Internal`Bag[];
Unprotect[Tanh];
Tanh[args___] := Block[{$inMsg = True, result},
result = N[Tanh[args]];
Internal`StuffBag[TanhBag, result];
result] /; ! TrueQ[$inMsg]
Protect[Tanh];
TanhBagLength := Internal`BagLength[TanhBag]
TanhBagContent := Internal`BagPart[TanhBag, All]
TanhBagReset := TanhBag = Internal`Bag[]
Example:
TanhBagReset;
Tanh[0.1]; Tanh[0.2]; Tanh[0.3];
{TanhBagContent, TanhBagLength}
{{0.099668, 0.197375, 0.291313}, 3}
I am using bags, introduced here, as it is a more efficient data type to be used in this manner than List. Using a list and AppendTo may cause performance issues. Bags, on the other hand, is the data type which is used to implement Reap/Sow and it is very suitable for this related purpose.
This solution has the nice property that we can define funResult and funRunningTimes (to use your terminology) without changing the definition of fun. Doing the same for
fun[n_] := N[2 n*Sin[n]]
is actually more complicated than was the case for built-in functions though. The Villegas-Gayley trick relies on the fact that built-in functions use a different context than user-defined functions. The user-defined wrapper function takes precedence in the evaluation order. A few different ways to solve this for user-defined functions are discussed here.
I think that, for the reasons Leonid discusses in the other Q&A, it should be safe to use Villegas-Gayley if Villegas-Gayley is evaluated before the function definition. If it is evaluated after the function definition, I think that
DownValues[fun] = RotateRight[DownValues[fun]];
should generally work, since the pattern in Villegas-Gayley is designed to be as general as possible, which in turn makes Mathematica put it as far down in the evaluation order as possible. (See Leonid's answer for more on this.)
Example:
funBagLength := Internal`BagLength[funBag]
funBagContent := Internal`BagPart[funBag, All]
funBagReset := funBag = Internal`Bag[]
Clear[fun]
fun[n_] := N[2 n*Sin[n]]
fun[args___] := Block[{$inMsg = True, result},
result = fun[args];
Internal`StuffBag[funBag, result];
result] /; ! TrueQ[$inMsg]
DownValues[fun] = RotateRight[DownValues[fun]];
Now run it:
funBagReset;
fun[0.1]; fun[0.2]; fun[0.3];
{funBagContent, funBagLength}
{{0.0199667, 0.0794677, 0.177312}, 3}