aqa-test-tools
aqa-test-tools copied to clipboard
Move Duplicate Code for Perf Graphs to Common Utils Library
Problem Description
Currently, we have 3 Perf widgets for Dashboard: DayTrader, ODM and SPECjbb2015. There is significant duplication of code between those 3 widgets since we just copied and modified the code from the first widget instead of using a common library while adding a new widget every time.
All perf graphs have the same purpose of displaying perf results for different benchmarks run on different platforms. Besides some specific data, everything else is the same among those widgets as shown below in the screenshots.


The graphs would have some minor feature difference because some of the features added by https://github.com/AdoptOpenJDK/openjdk-test-tools/pull/84, where not extended to all 3 perf widgets.
As a result, it's not easy to add new widgets for new benchmarks without duplicating code from some existing widget.
Proposed Changes
We should use a library to keep the common code, in order to avoid duplicating code for different benchmark widgets. For example, currently, utils.js just has one function parseSHA, which is used in multiple widgets but there is still enough scope to clean up code by moving common code to this library.
https://github.com/AdoptOpenJDK/openjdk-test-tools/blob/524d16e3784c17f4af6cee75f9105eb929397792/test-result-summary-client/src/Dashboard/Widgets/Graph/utils.js#L1-L2
https://github.com/AdoptOpenJDK/openjdk-test-tools/blob/524d16e3784c17f4af6cee75f9105eb929397792/test-result-summary-client/src/Dashboard/Widgets/Graph/ODM.jsx#L159-L160
https://github.com/AdoptOpenJDK/openjdk-test-tools/blob/524d16e3784c17f4af6cee75f9105eb929397792/test-result-summary-client/src/Dashboard/Widgets/Graph/DayTrader3.jsx#L151-L152
FYI @jiayaolinn @joransiu
It would be easier to add graphs for AcmeAir if we can clean up this code.
I think it is easier to complete this issue after https://github.com/AdoptOpenJDK/openjdk-test-tools/issues/106 as the data structure is updated.
As discussed, we break this issue into several parts. The first couple of tasks:
- Update internal server https://github.com/AdoptOpenJDK/openjdk-test-tools/issues/223
- create react component for charts
- update all graphs if needed
- TBD...