Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:20
eper
eper-0.97.5-map.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File eper-0.97.5-map.patch of Package eper
diff --git a/src/prfTrc.erl b/src/prfTrc.erl index d2197f6..9b9fb36 100644 --- a/src/prfTrc.erl +++ b/src/prfTrc.erl @@ -68,9 +68,7 @@ idle() -> active({not_started,R,HostPid}) -> HostPid ! {prfTrc,{not_started,R,self()}}, ?IDLE(); -active(LD) -> - Cons = dict:fetch(consumer,LD), - HostPid = dict:fetch(host_pid,LD), +active(#{consumer := Cons, host_pid := HostPid} = LD) -> receive {start,{Pid,_}} -> Pid ! {prfTrc,{already_started,self()}},?ACTIVE(LD); {stop,_} -> remote_stop(Cons,LD),?WAIT_FOR_LOCAL(Cons); @@ -95,15 +93,12 @@ remote_stop(Consumer, LD) -> stop_trace(LD), consumer_stop(Consumer). -stop_trace(LD) -> - erlang:trace(all,false,dict:fetch(flags,dict:fetch(conf,LD))), +stop_trace(#{conf := #{flags := Flags}}) -> + erlang:trace(all, false, Flags), unset_tps(). -start_trace(HostPid,Conf) -> - Rtps = expand_underscores(maybe_load_rtps(dict:fetch(rtps,Conf))), - start_trace( - dict:from_list([{host_pid,HostPid}, - {conf,dict:store(rtps,Rtps,Conf)}])). +start_trace(HostPid, #{rtps := Rtps} = Conf) -> + start_trace(#{host_pid => HostPid, conf => Conf#{rtps => expand_underscores(maybe_load_rtps(Rtps))}}). expand_underscores(Rtps) -> lists:foldl(fun expand_underscore/2,[],Rtps). @@ -162,19 +157,18 @@ maybe_load_rtp({{M,_,_},_MatchSpec,_Flags} = Rtp,O) -> _:_ -> O end. -start_trace(LD) -> - Conf = dict:fetch(conf,LD), - Consumer = consumer(dict:fetch(where,Conf),Conf), - Ps = lists:foldl(fun mk_prc/2,[],dict:fetch(procs,Conf)), - Rtps = dict:fetch(rtps,Conf), - Flags = [{tracer,real_consumer(Consumer)}|dict:fetch(flags,Conf)], +start_trace(#{conf := #{where := Where, procs := Procs, rtps := Rtps, flags := Flags} = Conf, + host_pid := HostPid} = LD) -> + Consumer = consumer(Where, Conf), + Ps = lists:foldl(fun mk_prc/2, [], Procs), + Flags = [{tracer, real_consumer(Consumer)}|Flags], unset_tps(), NoProcs = lists:sum([erlang:trace(P,true,Flags) || P <- Ps]), untrace(family(redbug)++family(prfTrc),Flags), NoFuncs = set_tps(Rtps), assert_trace_targets(NoProcs,NoFuncs,Flags,Ps), - dict:fetch(host_pid,LD) ! {prfTrc,{starting,NoProcs,NoFuncs,self(),Consumer}}, - dict:store(consumer,Consumer,LD). + HostPid ! {prfTrc, {starting, NoProcs, NoFuncs, self(), Consumer}}, + LD#{consumer => Consumer}. family(Daddy) -> try D = whereis(Daddy), @@ -249,38 +243,32 @@ consumer({ip,Port,Queue},Conf) -> consumer_ip(Port,Queue,Conf). consumer_stop(Pid) -> Pid ! stop. -consumer_pid({Pid,Cnt,MaxQueue,MaxSize},Buf,Conf) -> - Cnf = - dict:from_list( - [{daddy,self()}, - {count,Cnt}, - {time,dict:fetch(time,Conf)}, - {maxsize,MaxSize}, - {maxqueue,MaxQueue}, - {rtps,dict:fetch(rtps,Conf)}, - {where,Pid}, - {buffering,Buf}]), +consumer_pid({Pid, Cnt, MaxQueue, MaxSize}, Buf, #{time := Time, rtps := Rtps}) -> + Cnf = #{daddy => self(), + count => Cnt, + time => Time, + maxsize => MaxSize, + maxqueue => MaxQueue, + rtps => Rtps, + where => Pid, + buffering => Buf}, spawn_link(fun() -> init_local_pid(Cnf) end). -consumer_file(File,Size,WrapCount,Conf) -> - Cnf = - dict:from_list( - [{style,file} - , {file,File} - , {size,Size} - , {wrap_count,WrapCount} - , {time,dict:fetch(time,Conf)} - , {daddy, self()}]), +consumer_file(File, Size, WrapCount, #{time := Time}) -> + Cnf = #{style => file, + file => File, + size => Size, + wrap_count => WrapCount, + time => Time, + daddy => self()}, spawn_link(fun() -> init_local_port(Cnf) end). -consumer_ip(Port,QueueSize,Conf) -> - Cnf = - dict:from_list( - [{style,ip} - , {port_no,Port} - , {queue_size,QueueSize} - , {time,dict:fetch(time,Conf)} - , {daddy, self()}]), +consumer_ip(Port, QueueSize, #{time := Time}) -> + Cnf = #{style => ip, + port_no => Port, + queue_size => QueueSize, + time => Time, + daddy => self()}, spawn_link(fun() -> init_local_port(Cnf) end). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -290,15 +278,13 @@ consumer_ip(Port,QueueSize,Conf) -> %%% it gets a stop from the controller %%% timeout %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -init_local_port(Cnf) -> - erlang:start_timer(dict:fetch(time,Cnf),self(),dict:fetch(daddy,Cnf)), - Port = mk_port(Cnf), - loop_local_port(dict:store(port,Port,Cnf)). +init_local_port(#{time := Time, daddy := Daddy} = Cnf) -> + erlang:start_timer(Time, self(), Daddy), + loop_local_port(Cnf#{port => mk_port(Cnf)}). -loop_local_port(Cnf) -> - Daddy = dict:fetch(daddy, Cnf), +loop_local_port(#{daddy := Daddy} = Cnf) -> receive - {show_port,Pid} -> Pid ! dict:fetch(port,Cnf), + {show_port,Pid} -> Pid ! maps:get(port, Cnf), loop_local_port(Cnf); stop -> dbg:flush_trace_port(), exit(local_done); @@ -307,19 +293,9 @@ loop_local_port(Cnf) -> exit(timeout) end. -mk_port(Cnf) -> - case dict:fetch(style,Cnf) of - ip -> - Port = dict:fetch(port_no,Cnf), - QueueSize = dict:fetch(queue_size,Cnf), - (dbg:trace_port(ip,{Port, QueueSize}))(); - file -> - File = dict:fetch(file,Cnf), - WrapCount = dict:fetch(wrap_count,Cnf), - WrapSize = dict:fetch(size,Cnf)*1024*1024,% file size (per file) in MB. - Suffix = ".trc", - (dbg:trace_port(file,{File, wrap, Suffix, WrapSize, WrapCount}))() - end. +mk_port(#{style := ip, port_no := Port, queue_size := QueueSize}) -> (dbg:trace_port(ip, {Port, QueueSize}))(); +mk_port(#{style := file, file := File, wrap_count := WrapCount, size := Size}) -> + (dbg:trace_port(file, {File, wrap, ".trc", Size * (1024 * 1024), WrapCount}))(). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% local consumer process for pid-style tracing. @@ -333,15 +309,16 @@ mk_port(Cnf) -> %% -record(ld,{daddy,where,count,rtps,maxqueue,maxsize}). -init_local_pid(Cnf) -> - erlang:start_timer(dict:fetch(time,Cnf),self(),dict:fetch(daddy,Cnf)), - loop_lp({#ld{daddy =dict:fetch(daddy,Cnf), - where =dict:fetch(where,Cnf), - rtps =dict:fetch(rtps,Cnf), - maxsize =dict:fetch(maxsize,Cnf), - maxqueue =dict:fetch(maxqueue,Cnf)}, - buffering(dict:fetch(buffering,Cnf)), - dict:fetch(count,Cnf)}). +init_local_pid(#{time := Time, daddy := Daddy, where := Where, rtps := Rtps, + maxsize := MaxSize, maxqueue := MaxQueue, buffering := Buffering, count := Count}) -> + erlang:start_timer(Time, self(), Daddy), + loop_lp({#ld{daddy = Daddy, + where = Where, + rtps = Rtps, + maxsize = MaxSize, + maxqueue = MaxQueue}, + buffering(Buffering), + Count}). buffering(yes) -> []; buffering(Buf) -> Buf. diff --git a/src/redbug.erl b/src/redbug.erl index 5763d38..2ff4e9d 100644 --- a/src/redbug.erl +++ b/src/redbug.erl @@ -489,13 +489,13 @@ mfaf(I) -> %%% {file,File,Size,Count} | %%% {ip,Port,Queue} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -pack(Cnf) -> - {Flags,RTPs} = lists:foldl(fun chk_trc/2,{[],[]},slist(Cnf#cnf.trc)), - dict:from_list([{time,chk_time(Cnf#cnf.time)}, - {flags,[call,timestamp|maybe_arity(Cnf,Flags)]}, - {rtps,RTPs}, - {procs,[chk_proc(P) || P <- mk_list(Cnf#cnf.procs)]}, - {where,where(Cnf)}]). +pack(#cnf{trc = Trc, time = Time, procs = Procs} = Cnf) -> + {Flags, RTPs} = lists:foldl(fun chk_trc/2, {[], []}, slist(Trc)), + #{time => chk_time(Time), + flags => [call, timestamp|maybe_arity(Cnf, Flags)], + rtps => RTPs, + procs => lists:map(fun chk_proc/1, mk_list(Procs)), + where => where(Cnf)}. mk_list([]) -> throw(no_procs); mk_list([_|_] = L) -> L;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor