bart.thermal.ThermalAssert module

A thermal specific library to assert certain thermal behaviours

class bart.thermal.ThermalAssert.ThermalAssert(ftrace, config=None)[source]

Bases: object

A class that accepts a TRAPpy FTrace object and provides assertions for thermal behaviours

Parameters:ftrace (str, trappy.ftrace.FTrace) – A path to the trace file or a TRAPpy FTrace object
assertThermalResidency(expected_value, operator, temp_range, window, percent=False)[source]
Parameters:
  • expected_value (double) – The expected value of the residency
  • operator

    A binary operator function that returns a boolean. For example:

    import operator
    op = operator.ge
    assertThermalResidency(temp_range, expected_value, op)
    

    Will do the following check:

    getThermalResidency(temp_range) >= expected_value
    

    A custom function can also be passed:

    THRESHOLD=5
    def between_threshold(a, expected):
        return abs(a - expected) <= THRESHOLD
    
  • temp_range (tuple) – A tuple of (low_temp, high_temp) which specifies the range of temperature that one intends to calculate the residency for.
  • window (tuple) – A (start, end) tuple to limit the scope of the residency calculation.
  • percent (bool) – Returns the residency as a percentage of the total duration of the trace
getThermalResidency(temp_range, window, percent=False)[source]

Return the total time spent in a given temperature range

Parameters:
  • temp_range (tuple) – A tuple of (low_temp, high_temp) which specifies the range of temperature that one intends to calculate the residency for.
  • window (tuple) – A (start, end) tuple to limit the scope of the residency calculation.
  • percent (bool) – Returns the residency as a percentage of the total duration of the trace