legate.util.benchmark.BenchmarkLog#

class legate.util.benchmark.BenchmarkLog(
name: str,
uid: np.uint64,
columns: list[str],
file: TextIO,
metadata: dict[str, Any],
)#

Base class to manage logging of benchmarking data.

__init__(
name: str,
uid: np.uint64,
columns: list[str],
file: TextIO,
metadata: dict[str, Any],
) None#

Create a context manager for collecting benchmark data in a table.

Most users should use benchmark_log() instead of calling this directly.

Parameters:
  • name (str) – The name of the benchmark.

  • uid (np.uint64) – The unique identifier of the benchmark.

  • columns (list[str]) – The names for the columns of data that will be collected.

  • file (TextIO) – An output text stream to accept the data as it is collected.

  • metadata (dict[str, Any]) – Dictionary of metadata that will be included in the header of the table.

Attributes

Methods

__class_getitem__(args, /)

Represent a PEP 585 generic type

__enter__()

Open a log file to accept rows recorded with log().

__exit__(*exc_details)

Raise any exception triggered within the runtime context.

__subclasshook__(C)

Abstract classes can override this to customize issubclass().

_create_cb_wrapper(callback, /, *args, **kwds)

_create_exit_wrapper(cm, cm_exit)

_generate_and_log_metadata()

_get_row(row)

_log_columns(_columns)

_log_metadata(_metadata)

_log_row(_row)

_push_cm_exit(cm, cm_exit)

Helper to correctly register callbacks to __exit__ methods.

_push_exit_callback(callback[, is_sync])

callback(callback, /, *args, **kwds)

Registers an arbitrary callback and arguments.

close()

Immediately unwind the context stack.

enter_context(cm)

Enters the supplied context manager.

log(**kwargs)

Add a row to a benchmark table created in benchmark_log().

pop_all()

Preserve the context stack by transferring it to a new instance.

push(exit)

Registers a callback with the standard __exit__ method signature.