<jupyter_start><jupyter_text>Case1: Contents of the HTTP request<jupyter_code>var dbg = new Debugger("localhost", 25432);  // Using JDI
dbg.run();
Point p = dbg.stopAt("tomcatdemo.App", 18).get(); // Stop at line 18<jupyter_output>>> Debugger Info: Debugger started.<jupyter_text>Visit http://localhost:8080/TomcatDemo-0.0.1/home once from Google Chrome<jupyter_code>DebugResult dr = p.getResults().get("req");
var req = (ObjectInfo) dr.getLatestValue(); // Get the value of the variable req
req.invokeMethod(dbg.thread(), "getMethod");  // HTTP method
req.invokeMethod(dbg.thread(), "getRequestURI"); // Request URI
req.invokeMethod(dbg.thread(), "getHeader", "User-Agent"); // User-Agent header<jupyter_output><empty_output><jupyter_text>Case2: Identifying bottlenecks<jupyter_code>var dbg = new Debugger("localhost", 39876, true); // Using ProbeJ<jupyter_output><empty_output><jupyter_text>Set up observation points at the boundary of each section<jupyter_code>dbg.run();
String[] vars = {"noOfViews"};
List<Integer> lines = List.of(18, 20, 22, 24, 26);
var points = lines.stream()
                  .map(line -> dbg.watch("tomcatdemo.App", line, vars).get())
                  .collect(Collectors.toList());<jupyter_output>Try to connect to localhost:39876
Succeccfully connected to localhost:39876
>> Debugger Info: Debugger started.<jupyter_text>Visit http://localhost:8080/TomcatDemo-0.0.1/home once  Display of observation results<jupyter_code>var values =  new ArrayList<ValueInfo>();
points.forEach(p -> {
  var dr = p.getResults().get(vars[0]);
  values.add(dr.getLatestValue());
  println("value\t:\ttimestamp");
  dr.getValues().forEach(val -> {
    println(val.getValue()+"\t:\t"+val.getCreatedAt());
  }); 
})<jupyter_output>value	:	timestamp
0	:	2021-07-29T23:51:15.032
value	:	timestamp
0	:	2021-07-29T23:51:15.335
value	:	timestamp
0	:	2021-07-29T23:51:15.445
value	:	timestamp
0	:	2021-07-29T23:51:20.447
value	:	timestamp
0	:	2021-07-29T23:51:20.648<jupyter_text>Visualization of processing time for each section<jupyter_code>import java.time.temporal.ChronoUnit;

var x = new ArrayList<Double>();
var y = new ArrayList<Double>();

// Formatting data
for (int i = 0; i < values.size()-1; i++) {
  x.add((double) i+1);
  y.add((double) (ChronoUnit.MILLIS.between(values.get(i).getCreatedAt(), values.get(i+1).getCreatedAt())));
  println(y.get(i));
}

// Generating a diagram
CategoryChart chart = new CategoryChartBuilder().width(400).height(300).title("Performance Histogram")
                                                .xAxisTitle("Section").yAxisTitle("Time [msec]").build();
// Series
chart.addSeries("/home", x, y);
BitmapEncoder.getBufferedImage(chart);<jupyter_output>303.0
110.0
5002.0
201.0<jupyter_text>Survey results- The bottleneck is **Section 3**<jupyter_code>dbg.exit();<jupyter_output>>> Debugger Info: Debugger exited.
{'fraction_non_alphanumeric': 0.16083916083916083, 'fraction_numerical': 0.05909090909090909, 'mean_word_length': 5.010504201680672, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '302603', 'license': 'Apache-2.0', 'n_tokens_mistral': 1112, 'n_tokens_neox': 1002, 'n_words': 199, 'path': 'debugspace/cases-en.ipynb', 'repo_name': 'tklab-group/JISDLab', 'size': '2860'}