code: def get_function_stats(logging_file_path: str) -> pd.DataFrame:
      """Get execution (time) statistics for each function.
  
      Parameters
      ----------
      logging_file_path: str
          The file path where the logged messages are stored. This is the file path that
          is passed to the `FeatureCollection` its `calculate` method.
  
      Returns
      -------
      pd.DataFrame
          A DataFrame with for each function (i.e., `function-(window,stride)`)
          combination the mean (time), std (time), sum (time), sum (% time),
          mean (% time),and number of executions.
  
      """
      df = _parse_logging_execution_to_df(logging_file_path)
      # Get the sorted functions in a list to use as key for sorting the groups
      sorted_funcs = (
          df.groupby(["function"])
          .agg({"duration": ["mean"]})
          .sort_values(by=("duration", "mean"), ascending=True)
          .index.to_list()
      )
  
      def key_func(idx_level):
          if all(idx in sorted_funcs for idx in idx_level):
              return [sorted_funcs.index(idx) for idx in idx_level]
          return idx_level
  
      return (
          df.groupby(["function", "window", "stride"])
          .agg(
              {
                  "duration": ["sum", "mean", "std", "count"],
                  "duration %": ["sum", "mean"],
              }
          )
          .sort_index(key=key_func, ascending=False)
      )
  
file_path: tsflex/tsflex/features/logger.py
imports: import logging
  import re
  import numpy
  import pandas
  from ..utils.logging import logging_file_to_df, remove_inner_brackets
  from ..utils.time import timedelta_to_str
label_desc: Use image node_id 4 for calling a global function with example usage: get_function_stats(logging_file_path) and returns: df, idx_level, unknown