<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Naoto Ono</title>
    <description>The latest articles on DEV Community by Naoto Ono (@ono-max).</description>
    <link>https://dev.to/ono-max</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1082772%2F9aa43056-b281-46ec-a378-83f014c7465b.jpeg</url>
      <title>DEV Community: Naoto Ono</title>
      <link>https://dev.to/ono-max</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ono-max"/>
    <language>en</language>
    <item>
      <title>Intro to Trace Inspector that displays Ruby trace logs with pretty UI</title>
      <dc:creator>Naoto Ono</dc:creator>
      <pubDate>Wed, 24 May 2023 09:33:26 +0000</pubDate>
      <link>https://dev.to/ono-max/intro-to-trace-inspector-that-displays-ruby-trace-logs-with-pretty-ui-3pi7</link>
      <guid>https://dev.to/ono-max/intro-to-trace-inspector-that-displays-ruby-trace-logs-with-pretty-ui-3pi7</guid>
      <description>&lt;p&gt;Trace Inspector, a tool that displays Ruby trace logs with pretty UI while debugging in VS Code, has recently landed in &lt;a href="https://github.com/ruby/debug"&gt;debug.gem&lt;/a&gt;. debug.gem is a Ruby standard debugger library and the default debugger in Rails. Since debug.gem supports VS Code, you can debug Ruby programs in &lt;a href="https://github.com/ruby/vscode-rdbg"&gt;vscode-rdbg&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;What is unique about Trace Inspector compared to existing tracing tools is its cool UI. Trace Inspector give you the following benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Intuitive viewing of the trace logs.&lt;/li&gt;
&lt;li&gt;Check parameters and a return value for the trace log on the editor.&lt;/li&gt;
&lt;li&gt;Record the backtrace and local variables if necessary.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Trace Inspector helps you to read complex code.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/4L2MaEG_ir4"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Use cases for Trace Inspector
&lt;/h2&gt;

&lt;p&gt;We envisage two use cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Code reading to get a rough idea of the process&lt;/li&gt;
&lt;li&gt;Tracking detailed behaivor during debugging&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In other words, Trace Inspector is useful for code reading with a debugger. You may feel that code reading with a debugger is helpful, reading complex code is still hard. The difficulty of reading complex code with a debugger is that we have to remember all the different kinds of information at the points where we have paused until now. However, it's almost impossible. We may forget which method was called at a previous stopping point. Also, we may forget the method's parameters or a return value. This is a problem of code reading with a debugger.&lt;/p&gt;

&lt;p&gt;To solve the problem, we can use Trace Inspector. If we use Trace Inspector, we don't have to remember all the different kinds of information. We can check the information anytime. Also, we can copy the parameters and return values by clicking the target log.&lt;/p&gt;

&lt;h2&gt;
  
  
  Comparison with existing tracing tools
&lt;/h2&gt;

&lt;p&gt;There are some existing tools for tracing programs in Ruby. For example, ruby/tracer is one of the famous tracing tools. Also, debug.gem already had a feature for tracing programs in the terminal. One of the characteristics of the existing tools is that the terminal is used as a front-end. Although the terminal is helpful, we thought we could provide richer user experiences by using VS Code from the following advantages.&lt;/p&gt;

&lt;p&gt;The first advantage is the way of displaying trace logs. The following are examples of tracing a program with debug.gem in the terminal and tracing a program with Trace Inspector. The white bordered area is a single trace log. If we use Trace Inspector, we can see only what we want to see by clicking. In this picture, the trace logs in target.rb:5 are collapsed. We can say "I'm not interested in the trace logs here, so let's just collapse it".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZgPKokzq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yjjo4g4z6bukdiv00xui.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZgPKokzq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yjjo4g4z6bukdiv00xui.png" alt="Example of tracing a program in the terminal" width="630" height="157"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Tracing a program with debug.gem in the terminal&lt;/em&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ShsGfOS_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fbaemtoowrk2f5eth16o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ShsGfOS_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fbaemtoowrk2f5eth16o.png" alt="Example of tracing a program with Trace Inspector" width="331" height="228"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Tracing a program with Trace Inspector&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The second advantage is that trace logs can be viewed on the editor. If we click the specified log, the target file is opened, and the line is highlighted on the editor. Also, parameters and return values are displayed there.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BEYfK1by--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yvtafk0690rbn57aqnhl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BEYfK1by--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yvtafk0690rbn57aqnhl.png" alt="a trace log on the editor" width="331" height="228"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  How to use Trace Inspector
&lt;/h2&gt;
&lt;h3&gt;
  
  
  How to start Trace Inspector
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Set a breakpoint where it says, "puts set a breakpoint here" in the code.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tf6eB3Fc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tg5nyplw39fidtotgxpx.png" alt="Example of setting breakpoints" width="453" height="180"&gt;
&lt;/li&gt;
&lt;li&gt;Start debugging.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fky7xP1b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/660xptnq01lmb01cxb0z.png" alt="Example of button for starting debugging" width="432" height="106"&gt;
&lt;/li&gt;
&lt;li&gt;Click "TRACE INSPECTOR" view in the Sidebar to open it.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sxvn8T4r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ylaoan5r1w8qzb0jyvsu.png" alt='Example of closed "TRACE INSPECTOR" view' width="432" height="74"&gt;
&lt;/li&gt;
&lt;li&gt;Click "Enable Trace" button in "TRACE INSPECTOR" view.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TR6bwvBB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m017qdwb5553328juf28.png" alt='Example of "Enable Trace" button' width="376" height="74"&gt;
&lt;/li&gt;
&lt;li&gt;Click "Continue" in debug toolbar to resume the program.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I2xktPU_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1849nxp1bm42oqqfgmiq.png" alt='Example of "Continue" button' width="376" height="74"&gt;
&lt;/li&gt;
&lt;li&gt;The trace log appears in "TRACE INSPECTOR" view.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rmaFKuhj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oq9kf32c741dvqxk4m0q.png" alt="Example of displaying trace logs" width="753" height="602"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Congratulations! You were able to trace the log with Trace Inspector!&lt;/p&gt;
&lt;h3&gt;
  
  
  Diving into trace logs
&lt;/h3&gt;

&lt;p&gt;Trace logs are arranged in the order in which they are executed. For example, &lt;code&gt;target.rb:9&lt;/code&gt; was executed before &lt;code&gt;target.rb:10&lt;/code&gt; in this case.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OrfPoEdc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/80yyrs61a000n412ikfy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OrfPoEdc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/80yyrs61a000n412ikfy.png" alt="Example of trace logs" width="331" height="228"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are several kinds of icons in trace logs, as follows:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Line trace Log&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An icon such as a location icon is a Line trace log. It traces which line is executed. If you click the Line Trace log, the target file is opened, and the line is highlighted.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DSxTUB1d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5jsbp74eo8x7g6vtbc1k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DSxTUB1d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5jsbp74eo8x7g6vtbc1k.png" alt="Line trace log" width="331" height="228"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Call trace log&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A right arrow icon is the Call trace log. It traces which method is called. If you click the Call trace log, parameters are displayed on the editor in addition to the highlighting lines.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DfGpwpEY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e0tcx5b01o0yqafxbge2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DfGpwpEY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e0tcx5b01o0yqafxbge2.png" alt="Call trace log" width="331" height="228"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Return trace log&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A left arrow icon is the Line trace log. It traces which method is returned. If you click the Call trace log, a return value is displayed on the editor in addition to the highlighting lines.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KKbACuSZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4rcjzxz47s4oa188y58q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KKbACuSZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4rcjzxz47s4oa188y58q.png" alt="Return trace log" width="331" height="228"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Recording mode
&lt;/h3&gt;

&lt;p&gt;If we use Recording mode, we can record local variables and backtraces. Local variables and backtraces at the point of execution can be checked. For example, we can see how local variable A is assigned. The step to use this option is almost the same as described above. You need to click "•••" (more icon), then put a checkmark of "Record And Replay (Slow)" before clicking the "Enable Trace" button.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Set a breakpoint where it says, "puts set a breakpoint here" in the code.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tf6eB3Fc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tg5nyplw39fidtotgxpx.png" alt="Example of setting breakpoints" width="453" height="180"&gt;
&lt;/li&gt;
&lt;li&gt;Start debugging.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fky7xP1b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/660xptnq01lmb01cxb0z.png" alt="Example of button for starting debugging" width="432" height="106"&gt;
&lt;/li&gt;
&lt;li&gt;Click "TRACE INSPECTOR" view in the Sidebar to open it.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sxvn8T4r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ylaoan5r1w8qzb0jyvsu.png" alt='Example of closed "TRACE INSPECTOR" view' width="432" height="74"&gt;
&lt;/li&gt;
&lt;li&gt;Click "•••" (more icon), then put a checkmark of "Record And Replay (Slow)"
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H18YDIP2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/swmdq31kzqr1qlphu56t.png" alt="Example of context menu" width="428" height="172"&gt;
&lt;/li&gt;
&lt;li&gt;Click "Enable Trace" button in "TRACE INSPECTOR" view.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TR6bwvBB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m017qdwb5553328juf28.png" alt='Example of "Enable Trace" button' width="376" height="74"&gt;
&lt;/li&gt;
&lt;li&gt;Click "Continue" in debug toolbar to resume the program.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I2xktPU_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1849nxp1bm42oqqfgmiq.png" alt='Example of "Continue" button' width="376" height="74"&gt;
&lt;/li&gt;
&lt;li&gt;The trace log appears in "TRACE INSPECTOR" view.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rxbb-A1W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8w1v3ewt68pr46duf59v.png" alt="Example of displaying trace logs" width="800" height="567"&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Options for tracing
&lt;/h3&gt;

&lt;p&gt;"Trace Line" and "Trace Call/Return" is enabled in the default. The lower the table you go, the more log kinds you take.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Location&lt;/th&gt;
&lt;th&gt;Method name &amp;amp; Params&lt;/th&gt;
&lt;th&gt;Return Value&lt;/th&gt;
&lt;th&gt;Backtraces&lt;/th&gt;
&lt;th&gt;Local variables&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Trace Line (Default)&lt;/td&gt;
&lt;td&gt;✓&lt;/td&gt;
&lt;td&gt;N/A&lt;/td&gt;
&lt;td&gt;N/A&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Trace Call/Return (Default)&lt;/td&gt;
&lt;td&gt;✓&lt;/td&gt;
&lt;td&gt;✓&lt;/td&gt;
&lt;td&gt;✓&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Record And Replay&lt;/td&gt;
&lt;td&gt;✓&lt;/td&gt;
&lt;td&gt;✓&lt;/td&gt;
&lt;td&gt;✓&lt;/td&gt;
&lt;td&gt;✓&lt;/td&gt;
&lt;td&gt;✓&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  Some tips
&lt;/h3&gt;
&lt;h4&gt;
  
  
  Tracing only matched events that match specified regular expressions
&lt;/h4&gt;

&lt;p&gt;You can trace only the events that you want.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click "Apply filter by Regexp"
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J_ABHZHf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6rwtl4ayycgzsp5qcc9n.png" alt="Example of context menu in Trace Inspector" width="428" height="172"&gt;
&lt;/li&gt;
&lt;li&gt;Enter any string. (Also, you can filter by file path such as "target.rb")
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gx4lRNLU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uk5x0183onbgbrx7unyn.png" alt="Example of entering string" width="800" height="89"&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h4&gt;
  
  
  Copying a trace log
&lt;/h4&gt;

&lt;p&gt;You can copy trace logs as JSON objects.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Right-click a log that you want to copy.&lt;/li&gt;
&lt;li&gt;Click "Copy Trace log"&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nb0GtsgU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lshhc2apxqwtgh8ph83b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nb0GtsgU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lshhc2apxqwtgh8ph83b.png" alt="Example of right-clicking a trace log" width="278" height="98"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is an example of JSON objects.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"method"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Object#bar"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"location"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"path"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/Users/s15236/workspace/debug/target.rb"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"line"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"parameters"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"c"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"10"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"20"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Checking the process flow in frame-by-frame
&lt;/h4&gt;

&lt;p&gt;By clicking the arrow, you can check the process flow in frame-by-frame. The down arrow goes to the next log such as "Step Into". The up arrow goes to the previous log such as "Step Back".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R8I1D6Cq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ctj6pq5hp78pcylbgl5o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R8I1D6Cq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ctj6pq5hp78pcylbgl5o.png" alt="Example of arrows in the navigation bar" width="382" height="72"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Configuring the maximum size of trace logs that a debugger will save
&lt;/h4&gt;

&lt;p&gt;In the default, the maximum size of trace log stored by a debugger is 50000. If the size of trace logs exceeds the maximum size, the excess is removed from the oldest of the existing logs, and the new logs are inserted. You can change the setting as follows:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jZMqV-rT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tp6aw6atr2tzd4apso89.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jZMqV-rT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tp6aw6atr2tzd4apso89.png" alt="Example of Configuring the maximum size" width="800" height="292"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Performance comparison for each option
&lt;/h2&gt;

&lt;p&gt;Execution time always depends on the program. Thus, what we should focus is how much slower it is compared to normal. We can use Trace Line without worrying about anything since Trace Line is only 17 times slower than Normal run. We may feel a little slow when using Trace Call because Trace Call is only 203 times slower than Normal run. We need to accept that it will be a slow execution before starting Record And Replay. However, we plan to improve the perfomance for Record And Replay.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Execution Time(s)&lt;/th&gt;
&lt;th&gt;Ratio to Normal run&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Normal run (Without tracing)&lt;/td&gt;
&lt;td&gt;0.107&lt;/td&gt;
&lt;td&gt;1.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Trace Line&lt;/td&gt;
&lt;td&gt;1.886&lt;/td&gt;
&lt;td&gt;17.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Trace Call/Return&lt;/td&gt;
&lt;td&gt;21.729&lt;/td&gt;
&lt;td&gt;203.1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Record And Replay&lt;/td&gt;
&lt;td&gt;1,102.955&lt;/td&gt;
&lt;td&gt;10,308.0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Here is a script for measuring performance. This script is the part of Rails application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;index&lt;/span&gt;
  &lt;span class="nb"&gt;binding&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;break&lt;/span&gt; &lt;span class="c1"&gt;# &amp;lt;- Start a program here&lt;/span&gt;
  &lt;span class="mi"&gt;10_000&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;times&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;respond_to&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="nb"&gt;format&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
      &lt;span class="nb"&gt;format&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;html&lt;/span&gt; &lt;span class="c1"&gt;# index.html.erb&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt; &lt;span class="c1"&gt;#&amp;lt;- Pause a program here&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;ruby 3.2.1 (2023-02-08 revision 31819e82c8) [arm64-darwin21]&lt;/li&gt;
&lt;li&gt;MacBook Pro (16-inch, 2021)&lt;/li&gt;
&lt;li&gt;Chip: Apple M1 Max&lt;/li&gt;
&lt;li&gt;Memory: 32 GB&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I hope that you enjoy tracing Ruby programs with Trace Inspctor. Also, we look forward to your feedbacks!&lt;/p&gt;

&lt;h2&gt;
  
  
  Acknowlegement
&lt;/h2&gt;

&lt;p&gt;Special thanks to &lt;a href="https://github.com/ko1"&gt;Koichi Sasada-san&lt;/a&gt;. He helped me to design Trace Inspector!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
