Utilities for dealing with .cubex files

This module contains low-level functions that wrap/call the cube_dump utility.

cube_file_utils.get_dump(profile_file, exclusive=True)

Parses output of cube_dump on a .cubex file and returns a dataframe.

Thin wrapper around pandas.read_csv, to obtain pandas dataframes with all the metrics out of .cubex files via cube_dump. The layout of the dataframe is the same as the one coming out of cube_dump.

Parameters
  • profile_file (str) – Name of the .cubex file.

  • exclusive (bool) – Whether to ask cube_dump for exclusive (True) or inclusive (False) metrics.

Returns

res – A DataFrame containing all the metrics in the .cubex file.

Return type

pandas.DataFrame

cube_file_utils.get_cube_dump_w_text(profile_file)

Simple function that calls cube_dump -w and gets the output as a string.

Parameters

profile_file (str) – Name of the *.cubex file.

Returns

cube_dump_w_text – Output of cube_dump -w

Return type

str

cube_file_utils.get_lines(cube_dump_w_text, start_hint, end_hint)

Select a section of the output of ‘cube_dump -w’.

Parameters
  • cube_dump_w_text (str) – Text containing the whole output of cube_dump -w

  • start_hint (str) – String signalling the beginning of the section of interest.

  • end_hint (str) – String signalling the end of the section of interest.

Returns

lines – List of all non-empty lines between start_hint and end_hint.

Return type

list of str