libtcspc.write_events_to_binary_file¶
- libtcspc.write_events_to_binary_file(event_type, filename, *, truncate=False, append=False, batch_size=None, write_granularity_bytes=65536)[source]¶
Build a subgraph that writes events to a binary file.
This is a thin convenience composed of
Batch,ViewAsBytes, andWriteBinaryStreamwriting to aBinaryFileOutputStream. The resulting subgraph has one input named"input"that accepts individual events ofevent_typeand no outputs (it is a sink).- Parameters:
event_type (EventType) – Element type to write to the file. Must be a trivially-typed event.
filename (str or Param[str]) – Path to the output file. May be supplied as a runtime
Param.truncate (bool or Param[bool]) – If true, truncate the file if it already exists. Defaults to
False.append (bool or Param[bool]) – If true, append to the file if it already exists. Defaults to
False.batch_size (int or Param[int] or None) – Number of events per batch.
None(the default) uses theBatchdefault.write_granularity_bytes (int or Param[int]) – Write chunk size in bytes. Defaults to
65536. Larger writes have less overhead but may pollute CPU caches.
- Returns:
A subgraph with input
"input"and no outputs that writes events ofevent_typeto the file.- Return type:
See also
WriteBinaryStreamLower-level processor that writes byte buckets to an output stream.
BatchGroups individual events into batches.
ViewAsBytesViews bucketed events as their in-memory bytes.