Skip to content

Commit

Permalink
Move instrument.erl to runtime_tools
Browse files Browse the repository at this point in the history
instrument.erl can be a useful tool for debugging
memory allocation and memory leaks in production
systems. For example, eventually we could have a
button in Observer that invokes instrument and
prints a histogram on demand. For this purpose,
however, it must be part of runtime_tools.
  • Loading branch information
josevalim committed Feb 15, 2023
1 parent 5d77b48 commit 7671649
Show file tree
Hide file tree
Showing 19 changed files with 11 additions and 19 deletions.
4 changes: 2 additions & 2 deletions erts/doc/src/erlang.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4316,7 +4316,7 @@ is_process_alive(P2Pid),
<p>The total amount of memory currently allocated for
the emulator that is not directly related to any Erlang
process. Memory presented as <c>processes</c> is not
included in this memory. <seeerl marker="tools:instrument">
included in this memory. <seeerl marker="runtime_tools:instrument">
<c>instrument(3)</c></seeerl> can be used to
get a more detailed breakdown of what memory is part
of this type.</p>
Expand Down Expand Up @@ -4358,7 +4358,7 @@ is_process_alive(P2Pid),
when the emulator is run with instrumentation.</p>
<p>For information on how to run the emulator with
instrumentation, see
<seeerl marker="tools:instrument">
<seeerl marker="runtime_tools:instrument">
<c>instrument(3)</c></seeerl>
and/or <seecom marker="erl"><c>erl(1)</c></seecom>.</p>
</item>
Expand Down
4 changes: 2 additions & 2 deletions erts/doc/src/erts_alloc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@
<item>
<p>Adds a small tag to each allocated block that contains basic
information about what it is and who allocated it. Use the
<seeerl marker="tools:instrument"><c>instrument</c></seeerl>
<seeerl marker="runtime_tools:instrument"><c>instrument</c></seeerl>
module to inspect this information.</p>

<p>The runtime overhead is one word per allocation when enabled. This
Expand Down Expand Up @@ -913,7 +913,7 @@
<seeerl marker="erlang"><c>erlang(3)</c></seeerl>,
<seeerl marker="runtime_tools:erts_alloc_config">
<c>erts_alloc_config(3)</c></seeerl>,
<seeerl marker="tools:instrument">
<seeerl marker="runtime_tools:instrument">
<c>instrument(3)</c></seeerl></p>
</section>
</cref>
Expand Down
1 change: 1 addition & 0 deletions lib/runtime_tools/doc/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ XML_REF3_FILES = \
dbg.xml \
dyntrace.xml \
erts_alloc_config.xml \
instrument.xml \
system_information.xml \
msacc.xml \
scheduler.xml
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions lib/runtime_tools/doc/src/ref_man.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<xi:include href="dbg.xml"/>
<xi:include href="dyntrace.xml"/>
<xi:include href="erts_alloc_config.xml"/>
<xi:include href="instrument.xml"/>
<xi:include href="msacc.xml"/>
<xi:include href="scheduler.xml"/>
<xi:include href="system_information.xml"/>
Expand Down
1 change: 1 addition & 0 deletions lib/runtime_tools/doc/src/specs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
<xi:include href="../specs/specs_system_information.xml"/>
<xi:include href="../specs/specs_msacc.xml"/>
<xi:include href="../specs/specs_scheduler.xml"/>
<xi:include href="../specs/specs_instrument.xml"/>
</specs>
1 change: 1 addition & 0 deletions lib/runtime_tools/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ RELSYSDIR = $(RELEASE_PATH)/lib/runtime_tools-$(VSN)
MODULES= \
appmon_info \
erts_alloc_config \
instrument \
runtime_tools \
runtime_tools_sup \
dbg \
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/runtime_tools/src/runtime_tools.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{modules, [appmon_info, dbg,observer_backend,runtime_tools,
runtime_tools_sup,erts_alloc_config,
ttb_autostart,dyntrace,system_information,
scheduler,
scheduler, instrument,
msacc]},
{registered, [runtime_tools_sup]},
{applications, [kernel, stdlib]},
Expand Down
1 change: 1 addition & 0 deletions lib/runtime_tools/test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ include $(ERL_TOP)/make/$(TARGET)/otp.mk
MODULES = \
dyntrace_SUITE \
dyntrace_lttng_SUITE \
instrument_SUITE \
runtime_tools_SUITE \
system_information_SUITE \
dbg_SUITE \
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion lib/tools/doc/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ XML_REF3_FILES = \
fprof.xml \
cprof.xml \
lcnt.xml \
instrument.xml \
make.xml \
tags.xml \
xref.xml \
Expand Down
3 changes: 0 additions & 3 deletions lib/tools/doc/src/part.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@
Erlang programs. Uses trace to file to minimize runtime
performance impact, and displays time for calling and called
functions.</item>
<tag><em>instrument</em></tag>
<item>Utility functions for obtaining and analysing resource usage
in an instrumented Erlang runtime system.</item>
<tag><em>lcnt</em></tag>
<item>A lock profiling tool for the Erlang runtime system.</item>
<tag><em>make</em></tag>
Expand Down
5 changes: 0 additions & 5 deletions lib/tools/doc/src/ref_man.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@
performance impact, and displays time for calling and called
functions.</item>

<tag><em>instrument</em></tag>
<item>Utility functions for obtaining and analysing resource usage
in an instrumented Erlang runtime system.</item>

<tag><em>lcnt</em></tag>
<item>A lock profiling tool for the Erlang runtime system.</item>

Expand All @@ -75,7 +71,6 @@
<xi:include href="eprof.xml"/>
<xi:include href="erlang_mode.xml"/>
<xi:include href="fprof.xml"/>
<xi:include href="instrument.xml"/>
<xi:include href="lcnt.xml"/>
<xi:include href="make.xml"/>
<xi:include href="tags.xml"/>
Expand Down
1 change: 0 additions & 1 deletion lib/tools/doc/src/specs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
<xi:include href="../specs/specs_tags.xml"/>
<xi:include href="../specs/specs_cover.xml"/>
<xi:include href="../specs/specs_xref.xml"/>
<xi:include href="../specs/specs_instrument.xml"/>
<xi:include href="../specs/specs_erlang_mode.xml"/>
</specs>
1 change: 0 additions & 1 deletion lib/tools/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ MODULES= \
fprof \
cprof \
lcnt \
instrument \
make \
tags \
xref \
Expand Down
1 change: 0 additions & 1 deletion lib/tools/src/tools.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
cprof,
eprof,
fprof,
instrument,
lcnt,
make,
tags,
Expand Down
1 change: 0 additions & 1 deletion lib/tools/test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ MODULES = \
emacs_SUITE \
fprof_SUITE \
cprof_SUITE \
instrument_SUITE \
lcnt_SUITE \
make_SUITE \
tools_SUITE \
Expand Down
2 changes: 1 addition & 1 deletion system/doc/efficiency_guide/profiling.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<p>When looking at memory usage in a running system the most basic function
to get information from is <seemfa marker="erts:erlang#memory/0"><c>
erlang:memory()</c></seemfa>. It returns the current memory usage
of the system. <seeerl marker="tools:instrument"><c>instrument(3)</c></seeerl>
of the system. <seeerl marker="runtime_tools:instrument"><c>instrument(3)</c></seeerl>
can be used to get a more detailed breakdown of where memory is used.</p>
<p>Processes, ports and ets tables can then be inspected using their
respective info functions, i.e.
Expand Down

0 comments on commit 7671649

Please sign in to comment.