eclipse-cdt-cloud / theia-trace-extension

Eclipse Theia trace viewer extension using the Trace Server Protocol (TSP), through the tsp-typescript-client. Also the home for reusable JavaScript libraries: traceviewer-base, traceviewer-react-components
MIT License
49 stars 60 forks source link

Discover help with getting started, esp. compatible file formats #326

Open ebugden opened 3 years ago

ebugden commented 3 years ago

New users need more help with getting started. Because they don't have a lot invested in the plugin, they need to have smooth onboarding, or they'll give up.

Content

Quick help should point to:

Implementation

⚠️ Keep in mind @bhufmann comment:

Brainstorming

bhufmann: I think the trace server needs to provide the detailed information about supported trace types, getting started help etc. That would require a trace server protocol endpoint that the front-end can query and then display to the user.

Having the trace server provide:

Some less integrated (but easier to implement?) solutions:


Issue source: @ssmagula's user tests + brainstorming with TC and tool team members

ebugden commented 3 years ago

The Linux RT Wiki has some pages it could be fun to point beginners to:

Disclaimer: These were written by pre-information-design Erica so they sound pretentious and are heavy to read

ebugden commented 3 years ago

One suggestion is to create a "Getting started with tracing" help page (maybe on the Wiki here or a section in the project README) that helps new users get traces if they don't have any. A rough draft for this page is below.


Installing the tool locally

This allows you to view your own traces. See how to capture your own trace data below

To try the tool without tracing yourself, you can download example traces from the Trace Visualization Labs. To avoid installation and setup entirely, take a look at the live demo.

Capture a Quick Kernel Trace

Here's one way you can capture your own trace data to visualize!

Estimated time: 15 min

(Other Linux kernel tracers: Ftrace (point to instructions? ex. Real time wiki instructions))

1. Install LTTng tracer for kernel tracing

The LTTng installation documentation has distribution-specific instructions for how to install.

On Ubuntu, the commands would look something like:

# apt-get install lttng-tools (Libraries and command-line interface to control tracing) # apt-get install lttng-modules-dkms (Linux kernel modules to instrument and trace the kernel)

2. Trace the Linux kernel using LTTng

The LTTng kernel tracing quick start shows how to enable trace points in the kernel and then collect trace data.

All together, the commands would look something like: # lttng create kernel-session --output=~/quick-kernel-trace # lttng enable-event --kernel sched_switch,sched_process_fork # lttng enable-event --kernel --syscall open,close # lttng start [do something exciting like loading a website] # lttng destroy

3. Keep your kernel trace in a permanent place

Now you can take a look at your kernel trace with the Trace Viewer! Alternatively, kernelshark is a well known kernel trace viewer.

Dev setup

If you want to make modifications to the code or make contributions quick changes: gitpod download code

ebugden commented 3 years ago

Feedback from @arfio


Feedback from @ssmagula

bhufmann commented 3 years ago

@ebugden the getting started guide depends on the supported trace types in the trace server. The theia-trace-extension front-end is server-agnostic, for example, there might be trace servers that don't support LTTng or fTrace. The domain specific logic and data is in the trace servers. The getting started guide can't be entirely implemented on the front-end side only. I think the trace server needs to provide the detailed information about supported trace types, getting started help etc. That would require a trace server protocol endpoint that the front-end can query and then display to the user. What do you think?

ebugden commented 3 years ago

bhufmann: the getting started guide depends on the supported trace types in the trace server. The theia-trace-extension front-end is server-agnostic, for example, there might be trace servers that don't support LTTng or fTrace.

True! I'll add this important context to the issue description. Thank you.

bhufmann: I think the trace server needs to provide the detailed information about supported trace types, getting started help etc. That would require a trace server protocol endpoint that the front-end can query and then display to the user. What do you think?

For now I'm focusing on defining the content for a reasonably widely applicable help document (tracing on linux with ftrace) that could be tested and iterated on using a wireframe. I'm going to think more seriously about implementation after that.

I added more detailed thoughts in the implementation section of this issue description.

ebugden commented 3 years ago

WIP: 2nd draft for "Getting started with tracing" help page.

Changes:

Since the UI is moving around so much at this stage, maybe just point towards what tracing is, why it's useful, and how to get some traces. Maybe explain CTF folder structure. They'll have to manage on their own for opening traces and navigation.

Record kernel trace with ftrace Record a kernel trace with perf RT Wiki Ftrace doc

Which terms below will beginners not understand (ex. kernel)?


What is tracing?

What is tracing? Why use tracing? When to trace?

Use cases: Crash, Performance optimization, Structural code analysis

Capture a quick kernel trace

Here's one way you can capture your own trace data to visualize!

Setup ftrace

Remove this section? Just have them try to mount it in a script and have external resources they can go explore if something goes wrong. I think that's better. They don't necessarily need to understand everything at first. We just want to get them to a visualisation as quickly as possible.

Record a kernel trace

Record kernel trace with ftrace

TODO: Change so that mounting and enabling events via tracefs not debugfs

# Mount debugfs (TODO: change script so mounting tracefs)
sudo mount -t debugfs nodev /sys/kernel/debug # Remove this line? Move to previous section?

# Enable tracepoints (events) (TODO: Enable events via tracefs)
sudo echo 1 > /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/sched/sched_switch/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/sched/sched_waking/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/sched/sched_pi_setprio/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/sched/sched_process_fork/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/sched/sched_process_exit/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/sched/sched_process_free/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/irq/softirq_raise/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/irq/softirq_entry/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/irq/softirq_exit/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/irq/irq_handler_entry/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/irq/irq_handler_exit/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/block/block_rq_complete/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/block/block_rq_insert/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/block/block_rq_issue/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/block/block_bio_frontmerge/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/power/cpu_frequency/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/net/net_dev_queue/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/net/netif_receive_skb/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/timer/hrtimer_start/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/timer/hrtimer_cancel/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/timer/hrtimer_expire_entry/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/timer/hrtimer_expire_exit/enable
sudo echo 1 > /sys/kernel/debug/tracing/events/syscalls/enable

# Start tracing
sudo echo 1 > /sys/kernel/debug/tracing/tracing_on

# Something to trace
wget https://lttng.org

# Stop tracing
sudo echo 0 > /sys/kernel/debug/tracing/tracing_on

TODO: Add downloadable script?

Analyze the trace

ebugden commented 2 years ago

This issue came up again during a user-centered planning process.

Need: Help me learn what and how trace

As a new user, I need some guidance and assistance to get started with trace recording, so that I can go from being a total newb, to a novice more quickly and with less pain.

Provide: