Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor RecipeCommon.Perf result classes #263

Open
olichtne opened this issue Nov 11, 2022 · 0 comments
Open

Refactor RecipeCommon.Perf result classes #263

olichtne opened this issue Nov 11, 2022 · 0 comments

Comments

@olichtne
Copy link
Collaborator

This is related to my work in #258 and partially to the refactor in #261.

The results objects at the moment basically implement the common interface defined by the BaseMeasurementResults method and then add property methods to add access to the measured metrics.

After adding the MeasurementResults objects to the RecipeResults array for easier data access for post analysis I think the next logical step is to make the MeasurementResults objects a bit easier to work with in an automated way.

What I'm thinking of is to define a new common interface property or method to access all metrics defined by any specific measurement result object. Something that would basically allow us to do:

measurement_result = IperfMeasurementResults(....)

for metric_name, measurement_values in measurement_result.metrics.items():
    ....

A simple dictionary implementation of course works, and is IMO likely to be the best choice here but maybe there's a better solution that I haven't thought of yet.

In addition to that I think that this would allow us to reimplement the Aggregated* result classes in a generic way since we'll simply be able to define their interface as:

class AggregatedBaseMeasurementResults(BaseMeasurementResults):
    def __init__(self, *args, **kwargs):
           super().__init__(*args, **kwargs)
           self._individual_results = []

    @property
    def metrics(self):
        res = {}
        for metric_name in self._individual_results[0].keys():
              res[metric_name] = SequentialResult([res.metrics[metric_name] for res in self._individual_results])
        return res

This will need a bit more experimentation and a bit more thought into how SPECIFICALLY this will actually extend the individual result classes, but this is the generic idea that I think should be possible and would probably greatly help with both post run analysis, additional calculations, but also code maintainability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant