|
@ -1,4 +1,5 @@ |
|
|
-module(tpCallGrind). %% 调用堆栈和时间分析 |
|
|
-module(tpCallGrind). %% 调用堆栈和时间分析 |
|
|
|
|
|
-include("eTpf.hrl"). |
|
|
|
|
|
|
|
|
-export([ |
|
|
-export([ |
|
|
pfs/2 |
|
|
pfs/2 |
|
@ -446,7 +447,8 @@ cacheModule({Module, _, _} = MFA, #state{sources = Cache} = State, Src) -> |
|
|
{Module, Beam, _} = code:get_object_code(Module), |
|
|
{Module, Beam, _} = code:get_object_code(Module), |
|
|
{ok, {Module, Chunks}} = beam_lib:chunks(Beam, [abstract_code]), |
|
|
{ok, {Module, Chunks}} = beam_lib:chunks(Beam, [abstract_code]), |
|
|
[{abstract_code, {raw_abstract_v1, Forms}}] = Chunks, |
|
|
[{abstract_code, {raw_abstract_v1, Forms}}] = Chunks, |
|
|
Funcs = [{{Module, F, A}, LN} || {function, LN, F, A, _} <- Forms], |
|
|
|
|
|
|
|
|
Funcs = [begin case LN of {Line, _} -> {{Module, F, A}, Line}; _ -> {{Module, F, A}, LN} end end || {function, LN, F, A, _} <- Forms], |
|
|
|
|
|
|
|
|
NewCache = lists:foldl(fun({Key, LN}, Acc) -> Acc#{Key => {Src, LN}} end, Cache, Funcs), |
|
|
NewCache = lists:foldl(fun({Key, LN}, Acc) -> Acc#{Key => {Src, LN}} end, Cache, Funcs), |
|
|
%% We cannot currently retrieve line number information |
|
|
%% We cannot currently retrieve line number information |
|
|
%% for list comprehensions and funs. We therefore |
|
|
%% for list comprehensions and funs. We therefore |
|
|