Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

changed the file structure to the traditional src/ebin/priv etc.

  fixed a bug in sherk_ets:f2t


git-svn-id: https://eper.googlecode.com/svn/trunk@76 5f96f306-4121-0410-aeb0-fb9935354dc2
  • Loading branch information...
commit 4b7cf8bdfe7e1246a746125e613ff6178b3bf94b 1 parent eaeb39e
@massemanet authored
Showing with 124 additions and 106 deletions.
  1. +5 −0 ChangeLog
  2. +1 −1  Makefile.am
  3. +4 −0 bin/Makefile.am
  4. 0  {dtop → bin}/dtop
  5. 0  {gperf → bin}/gperf
  6. 0  {ntop → bin}/ntop
  7. 0  {redbug → bin}/redbug
  8. 0  {sherk → bin}/sherk
  9. +3 −7 configure.ac
  10. 0  {redbug → doc}/redbug.txt
  11. +0 −17 dtop/Makefile.am
  12. +0 −20 gperf/Makefile.am
  13. +0 −47 sherk/sherk_tab.erl
  14. +32 −0 src/Makefile.am
  15. 0  {dtop → src}/dtop.erl
  16. 0  {dtop → src}/dtopConsumer.erl
  17. 0  {gperf → src}/gperf.erl
  18. 0  {gperf → src}/gperf.glade
  19. 0  {gperf → src}/gperf.gladep
  20. 0  {gperf → src}/gperfConsumer.erl
  21. 0  {gperf → src}/gperfGtk.erl
  22. 0  {ntop → src}/ntop.erl
  23. 0  {ntop → src}/ntopConsumer.erl
  24. 0  {prf → src}/prf.erl
  25. 0  {prf → src}/prfClient.erl
  26. 0  {prf → src}/prfHost.erl
  27. 0  {prf → src}/prfNet.erl
  28. 0  {prf → src}/prfPrc.erl
  29. 0  {prf → src}/prfSys.erl
  30. 0  {prf → src}/prfTarg.erl
  31. 0  {prf → src}/prfTrc.erl
  32. +0 −2  {redbug → src}/redbug.erl
  33. 0  {redbug → src}/redbugConsumer.erl
  34. 0  {sherk → src}/sherk.erl
  35. 0  {sherk → src}/sherk.glade
  36. 0  {sherk → src}/sherk.gladep
  37. 0  {sherk → src}/sherk_aquire.erl
  38. +24 −12 {sherk → src}/sherk_ets.erl
  39. 0  {sherk → src}/sherk_list.erl
  40. 0  {sherk → src}/sherk_prof.erl
  41. 0  {sherk → src}/sherk_scan.erl
  42. +55 −0 src/sherk_tab.erl
  43. 0  {sherk → src}/sherk_target.erl
  44. 0  {sherk → src}/sherk_tree.erl
View
5 ChangeLog
@@ -1,3 +1,8 @@
+2007-05-17 Mats Cronqvist <locmacr@mwlx084>
+
+ * src/sherk_ets.erl:
+ f2t/1 (file2tab) was broken...
+
2007-05-10 Mats Cronqvist <locmacr@mwlx084>
* redbug/redbug.erl:
View
2  Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = dtop gperf ntop prf redbug sherk
+SUBDIRS = src bin
clean-local:
-find . -name "*~" -exec rm {} \;
View
4 bin/Makefile.am
@@ -0,0 +1,4 @@
+bindir = $(ERLANG_INSTALL_LIB_DIR_eper)/priv/bin
+dist_bin_SCRIPTS = dtop gperf gperf ntop redbug sherk
+
+EXTRA_DIST = $(dist_bin_SCRIPTS)
View
0  dtop/dtop → bin/dtop
File renamed without changes
View
0  gperf/gperf → bin/gperf
File renamed without changes
View
0  ntop/ntop → bin/ntop
File renamed without changes
View
0  redbug/redbug → bin/redbug
File renamed without changes
View
0  sherk/sherk → bin/sherk
File renamed without changes
View
10 configure.ac
@@ -1,4 +1,4 @@
-AC_INIT(Various Erlang performance related tools, 0.34,
+AC_INIT(Various Erlang performance related tools, 0.35,
mats.cronqvist@ericsson.com, eper)
dnl Require autoconf version >=2.59c. first one with erlang macros
AC_PREREQ(2.59c)
@@ -36,12 +36,8 @@ AC_SUBST([GTKDOCLINKS], [$_gtkdoclinks])
dnl Specify the files to instantiate.
AC_CONFIG_FILES([ \
Makefile \
- dtop/Makefile \
- gperf/Makefile \
- ntop/Makefile \
- prf/Makefile \
- redbug/Makefile \
- sherk/Makefile \
+ src/Makefile \
+ bin/Makefile \
])
AC_OUTPUT
View
0  redbug/redbug.txt → doc/redbug.txt
File renamed without changes
View
17 dtop/Makefile.am
@@ -1,17 +0,0 @@
-erlsrcdir = $(ERLANG_INSTALL_LIB_DIR_eper)/src
-erlsrc_DATA = dtop.erl dtopConsumer.erl
-
-bindir = $(ERLANG_INSTALL_LIB_DIR_eper)/priv/bin
-dist_bin_SCRIPTS = dtop
-
-erlbeamdir = $(ERLANG_INSTALL_LIB_DIR_eper)/ebin
-erlbeam_DATA = $(patsubst %.erl, %.beam, $(erlsrc_DATA))
-
-EXTRA_DIST = $(erlsrc_DATA) $(dist_bin_SCRIPTS)
-CLEANFILES = $(erlbeam_DATA)
-
-all: $(erlbeam_DATA)
-
-SUFFIXES = .erl .beam
-.erl.beam:
- $(ERLC) $(ERLCFLAGS) -b beam $<
View
20 gperf/Makefile.am
@@ -1,20 +0,0 @@
-erlsrcdir = $(ERLANG_INSTALL_LIB_DIR_eper)/src
-erlsrc_DATA = gperf.erl gperfConsumer.erl gperfGtk.erl
-
-bindir = $(ERLANG_INSTALL_LIB_DIR_eper)/priv/bin
-dist_bin_SCRIPTS = gperf
-
-gladedir = $(ERLANG_INSTALL_LIB_DIR_eper)/priv/glade
-glade_DATA = gperf.gladep gperf.glade
-
-erlbeamdir = $(ERLANG_INSTALL_LIB_DIR_eper)/ebin
-erlbeam_DATA = $(patsubst %.erl, %.beam, $(erlsrc_DATA))
-
-EXTRA_DIST = $(erlsrc_DATA) $(glade_DATA)
-CLEANFILES = $(erlbeam_DATA)
-
-all: $(erlbeam_DATA)
-
-SUFFIXES = .erl .beam
-.erl.beam:
- $(ERLC) $(ERLCFLAGS) -b beam $<
View
47 sherk/sherk_tab.erl
@@ -1,47 +0,0 @@
-%%%-------------------------------------------------------------------
-%%% File : sherk_tab.erl
-%%% Author : Mats Cronqvist <locmacr@mwlx084>
-%%% Description :
-%%%
-%%% Created : 21 Aug 2006 by Mats Cronqvist <locmacr@mwlx084>
-%%%-------------------------------------------------------------------
--module(sherk_tab).
-
--export([assert/1,check_file/1]).
-
--import(filename,[dirname/1,join/1,basename/2]).
-
--include_lib("kernel/include/file.hrl").
-
--define(LOG(T), sherk:log(process_info(self()),T)).
-
-assert(File) ->
- TabFile = dirname(File)++"/."++basename(File,".trz")++".etz",
- {ok,#file_info{mtime=MT}} = file:read_file_info(File),
- case file:read_file_info(TabFile) of
- {ok,#file_info{mtime=TabMT}} when MT < TabMT ->
- %% the tab file exists and is up-to-date
- case sherk_ets:lup(sherk_prof, file) of
- File -> ?LOG({is_cached,TabFile});
- _ -> ?LOG(restoring_tab),sherk_ets:f2t(TabFile)
- end;
- _ ->
- %% make tab and save it
- ?LOG([creating_tab]),
- sherk_scan:go(File,'',sherk_prof,0,''),
- ets:insert(sherk_prof, {file, File}),
- try
- ?LOG(storing_tab),
- sherk_ets:t2f([sherk_prof,sherk_scan],TabFile)
- catch
- _:_ -> ?LOG({creation_failed,TabFile})
- end
- end,
- ?LOG([folding_pids]),
- ets:foldl(fun store_pid/2, [], sherk_prof),
- ?LOG([done]).
-
-store_pid({{{pid,time},P},_},_) -> ets:insert(sherk_prof,{sherk:to_str(P),P});
-store_pid(_,_) -> ok.
-
-check_file(File) -> ".trz" = filename:extension(File).
View
32 src/Makefile.am
@@ -0,0 +1,32 @@
+erlsrcdir = $(ERLANG_INSTALL_LIB_DIR_eper)/src
+
+erlsrc_DATA = ntop.erl ntopConsumer.erl \
+ dtop.erl dtopConsumer.erl \
+ gperf.erl gperfConsumer.erl gperfGtk.erl \
+ gperf.erl gperfConsumer.erl gperfGtk.erl \
+ prfNet.erl prfSys.erl prfPrc.erl prfTrc.erl \
+ prf.erl prfHost.erl prfTarg.erl prfClient.erl \
+ prfNet.erl prfSys.erl prfPrc.erl prfTrc.erl \
+ prf.erl prfHost.erl prfTarg.erl prfClient.erl \
+ prfNet.erl prfSys.erl prfPrc.erl prfTrc.erl \
+ prf.erl prfHost.erl prfTarg.erl prfClient.erl \
+ redbug.erl redbugConsumer.erl \
+ sherk.erl sherk_tab.erl sherk_prof.erl \
+ sherk_tree.erl sherk_list.erl sherk_scan.erl sherk_aquire.erl \
+ sherk_target.erl sherk_ets.erl
+
+gladedir = $(ERLANG_INSTALL_LIB_DIR_eper)/priv/glade
+glade_DATA = gperf.gladep gperf.glade \
+ sherk.gladep sherk.glade
+
+erlbeamdir = $(ERLANG_INSTALL_LIB_DIR_eper)/ebin
+erlbeam_DATA = $(patsubst %.erl, %.beam, $(erlsrc_DATA))
+
+EXTRA_DIST = $(erlsrc_DATA)
+CLEANFILES = $(erlbeam_DATA)
+
+all: $(erlbeam_DATA)
+
+%.beam: %.erl
+ echo $(PWD)
+ $(ERLC) $(ERLCFLAGS) $<
View
0  dtop/dtop.erl → src/dtop.erl
File renamed without changes
View
0  dtop/dtopConsumer.erl → src/dtopConsumer.erl
File renamed without changes
View
0  gperf/gperf.erl → src/gperf.erl
File renamed without changes
View
0  gperf/gperf.glade → src/gperf.glade
File renamed without changes
View
0  gperf/gperf.gladep → src/gperf.gladep
File renamed without changes
View
0  gperf/gperfConsumer.erl → src/gperfConsumer.erl
File renamed without changes
View
0  gperf/gperfGtk.erl → src/gperfGtk.erl
File renamed without changes
View
0  ntop/ntop.erl → src/ntop.erl
File renamed without changes
View
0  ntop/ntopConsumer.erl → src/ntopConsumer.erl
File renamed without changes
View
0  prf/prf.erl → src/prf.erl
File renamed without changes
View
0  prf/prfClient.erl → src/prfClient.erl
File renamed without changes
View
0  prf/prfHost.erl → src/prfHost.erl
File renamed without changes
View
0  prf/prfNet.erl → src/prfNet.erl
File renamed without changes
View
0  prf/prfPrc.erl → src/prfPrc.erl
File renamed without changes
View
0  prf/prfSys.erl → src/prfSys.erl
File renamed without changes
View
0  prf/prfTarg.erl → src/prfTarg.erl
File renamed without changes
View
0  prf/prfTrc.erl → src/prfTrc.erl
File renamed without changes
View
2  redbug/redbug.erl → src/redbug.erl
@@ -61,8 +61,6 @@ start(X) ->
io:fwrite("bad args: ~p~n",[X]),
erlang:halt(1).
-start(Time,Msgs,Trc) -> start(Time,Msgs,Trc,all).
-
start(Time,Msgs,Trc) -> go(Time,Msgs,Trc,#cnf{}).
start(Time,Msgs,Trc,Proc) -> go(Time,Msgs,Trc,#cnf{proc=Proc}).
View
0  redbug/redbugConsumer.erl → src/redbugConsumer.erl
File renamed without changes
View
0  sherk/sherk.erl → src/sherk.erl
File renamed without changes
View
0  sherk/sherk.glade → src/sherk.glade
File renamed without changes
View
0  sherk/sherk.gladep → src/sherk.gladep
File renamed without changes
View
0  sherk/sherk_aquire.erl → src/sherk_aquire.erl
File renamed without changes
View
36 sherk/sherk_ets.erl → src/sherk_ets.erl
@@ -59,21 +59,26 @@ lup(Tab, Key) ->
%% tab2file/2 and file2tab/1 replacements
%% stores multiple tabs in compressed files
+%% file format is;
+%% <<TabInfoSize:32/integer>>,<<TabInfo:TabInfoSize/binary>>,
+%% [<<ObjectSize:32/integer>>,<<Object:ObjectSize/binary>>,...]
+%% <<0:32/integer>>
+
t2f(Tabs, File) when is_list(Tabs) ->
case file:open(File,[write,compressed,raw,binary]) of
{error,R} ->
exit({error_opening,R,File});
{ok,FD} ->
try t2f(Tabs,FD,0)
- after file:close(FD)
- end
+ after file:close(FD)
+ end
end.
t2f([],_FD,N) -> N;
t2f([Tab|Tabs],FD,N) ->
- file:write(FD,<<0:32/integer>>),
t2f_f(make_info(Tab),FD),
ets:foldl(fun t2f_f/2,FD,Tab),
+ file:write(FD,<<0:32/integer>>),
t2f(Tabs,FD,N+1).
make_info(Tab) ->
@@ -95,7 +100,7 @@ f2t(File) ->
{error,R} ->
exit({error_opening,R,File});
{ok,FD} ->
- try f2t_f(FD), do_tabs(f2t_f(FD),FD,[])
+ try do_tabs(get_tab_header(FD),FD,[])
after file:close(FD)
end
end.
@@ -105,26 +110,33 @@ do_tabs(eof,_FD,O) ->
do_tabs({Name,Opts},FD,O) ->
new(Name,Opts),
Cnt = f2t(FD,Name,0),
- do_tabs(f2t_f(FD),FD,[{Name,Cnt}|O]).
+ do_tabs(get_tab_header(FD),FD,[{Name,Cnt}|O]).
+
+get_tab_header(FD) ->
+ try f2t_f(FD)
+ catch
+ throw:eof -> eof;
+ _:X -> exit({bad_header,X})
+ end.
+
f2t(FD,Tab,N) ->
try
ets:insert(Tab,f2t_f(FD)),
f2t(FD,Tab,N+1)
catch
- throw:eof -> N;
- throw:bot -> N
+ throw:delimiter -> N;
+ throw:eof -> exit({unexpected_eof})
end.
f2t_f(FD) ->
case file:read(FD,4) of
- {ok,<<0:32/integer>>} -> throw(bot);
+ eof -> throw(eof);
+ {ok,<<0:32/integer>>} -> throw(delimiter);
{ok,<<Size:32/integer>>} ->
case file:read(FD,Size) of
{ok,Bin} -> binary_to_term(Bin);
- {error,R} -> exit({error_reading,R});
- eof -> exit({unexpected_eof})
+ R -> exit({error_reading_term,R})
end;
- eof -> throw(eof);
- {error,R} -> exit({error_reading,R})
+ R -> exit({error_reading_size,R})
end.
View
0  sherk/sherk_list.erl → src/sherk_list.erl
File renamed without changes
View
0  sherk/sherk_prof.erl → src/sherk_prof.erl
File renamed without changes
View
0  sherk/sherk_scan.erl → src/sherk_scan.erl
File renamed without changes
View
55 src/sherk_tab.erl
@@ -0,0 +1,55 @@
+%%%-------------------------------------------------------------------
+%%% File : sherk_tab.erl
+%%% Author : Mats Cronqvist <locmacr@mwlx084>
+%%% Description :
+%%%
+%%% Created : 21 Aug 2006 by Mats Cronqvist <locmacr@mwlx084>
+%%%-------------------------------------------------------------------
+-module(sherk_tab).
+
+-export([assert/1,check_file/1]).
+
+-import(filename,[dirname/1,join/1,basename/2]).
+
+-include_lib("kernel/include/file.hrl").
+
+-define(LOG(T), sherk:log(process_info(self()),T)).
+
+assert(File) ->
+ TabFile = dirname(File)++"/."++basename(File,".trz")++".etz",
+ {ok,#file_info{mtime=MT}} = file:read_file_info(File),
+ case file:read_file_info(TabFile) of
+ {ok,#file_info{mtime=TabMT}} when MT < TabMT ->
+ %% the tab file exists and is up-to-date
+ case sherk_ets:lup(sherk_prof, file) of
+ File -> ?LOG({is_cached,TabFile});
+ _ ->
+ ?LOG(restoring_tab),
+ try sherk_ets:f2t(TabFile)
+ catch
+ _:X ->
+ ?LOG({deleting_bad_tab_file,X}),
+ file:delete(TabFile),
+ assert(File)
+ end
+ end;
+ _ ->
+ %% make tab and save it
+ ?LOG([creating_tab]),
+ sherk_scan:go(File,'',sherk_prof,0,''),
+ ets:insert(sherk_prof, {file, File}),
+ try
+ ?LOG(storing_tab),
+ sherk_ets:t2f([sherk_prof,sherk_scan],TabFile)
+ catch
+ _:_ -> ?LOG({creation_failed,TabFile})
+ end
+ end,
+ ?LOG([folding_pids]),
+ ets:foldl(fun store_pid/2, [], sherk_prof),
+ ?LOG([done]).
+
+store_pid({{{pid,time},P},_},_) -> ets:insert(sherk_prof,{sherk:to_str(P),P});
+store_pid(_,_) -> ok.
+
+check_file(File) -> ".trz" = filename:extension(File).
View
0  sherk/sherk_target.erl → src/sherk_target.erl
File renamed without changes
View
0  sherk/sherk_tree.erl → src/sherk_tree.erl
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.