Fix trace view's x-axis
This MR fixes issues in the trace view to evenly spread tick labels and improve the precision.
Fixes:
- It separates the model for the tick's calculation AxisXTicks and the presentation CanvasAxisX to facilitate the unit test to check the validity of the tick and label position
- It improves the tick precision by calculating using the original time unit (nanoseconds) and then converting it to the display time unit (can be seconds, minutes, or hours). It also avoids implicit or explicit conversion with a single precision or integer to reduce loss of precision.
- It ensures the gap between tick's labels is consistent.
- It calculates to find rounded labels of ticks such as
14.0instead of13.9.
Test improvements:
- It adds a new unit test AxisXTicksTest to check the correctness of ticks calculation.
- It refines
CanvasAxisXTestto visualize to ensure no crash when displaying it.
Caveats:
- This MR fixes tick labels' position evenly but does NOT fix the number of pixels between ticks. If the width of the trace screen is not evenly divided by the number of ticks, some ticks have one more pixel than others. One can fix this by adjusting the width of the trace, but this requires careful overhaul due to effects with Depth and Summary views.
Signed-off-by: Laksono Adhianto laksono@gmail.com