Is there a .Net C# profiler that can report separate statistics for different typed execution of a generic method? -
say have simple program:
using system; using system.collections.generic; using system.linq; using system.text; namespace profilertesting { class program { static void myfunc<t>(t t) { system.threading.thread.sleep(100); console.writeline(t); } static void main(string[] args) { ilist<string> l = new list<string> { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m" }; foreach (string s in l) { myfunc(s); } ilist<int> g = new list<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; foreach (int in g) { myfunc(i); } } } }
when profile program using .net profiler (i've tried both equatec profiler free version , visual studio performance tools) in sampling mode, gives me total execution statistics myfunc<t>
only. there way can separate execution statistics myfunc<string>
, myfunc<int>
?
i not know tools can this, , don't think ever can possible.
if take on generic definition methods find this
a generic method definition method 2 parameter lists: list of generic type parameters , list of formal parameters. type parameters can appear return type or types of formal parameters, following code shows.
we can rephrase question "is possible differentiate on call stacks functions different parameter values?". answer no. of course somehow can possible, nobody implement this, because huge amount of data , hard analyse data.
on call stacks when have myfunc
can find myfunc<t>(t t)
, without information parameters (type or formal).
for case better separate method in 2 if want measure performance separately.
Comments
Post a Comment