ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
cache_bench_io.c File Reference

Bounded formatting and complete-write helpers for cache_bench. More...

#include "cache_bench_io.h"
#include <stdio.h>
Include dependency graph for cache_bench_io.c:

Go to the source code of this file.

Enumerations

enum  cb_io_limit_t : size_t {
  k_cb_format_capacity = 512U ,
  k_cb_write_limit = 1048576U
}

Functions

cb_io_status_t cb_sink_write_all (cb_sink_t *sink, const void *data, size_t length)
 Write every byte, retrying bounded short writes.
cb_io_status_t cb_sink_vformat (cb_sink_t *sink, const char *format, va_list args)
 Format one bounded record and publish it atomically to the sink seam.
cb_io_status_t cb_sink_format (cb_sink_t *sink, const char *format,...)
 Format one bounded record and publish it atomically to the sink seam.

Detailed Description

Bounded formatting and complete-write helpers for cache_bench.

Completes short injected writes and formats one bounded automatic record without owning a stream or acquiring dynamic storage.

[Ring 7 / Tooling] {World: NS}

Since
0.1.0

Definition in file cache_bench_io.c.

Enumeration Type Documentation

◆ cb_io_limit_t

enum cb_io_limit_t : size_t
Enumerator
k_cb_format_capacity 

Largest single report fragment.

k_cb_write_limit 

Fail-closed short-write retry bound.

Definition at line 17 of file cache_bench_io.c.

Function Documentation

◆ cb_sink_format()

cb_io_status_t cb_sink_format ( cb_sink_t * sink,
const char * format,
... )

Format one bounded record and publish it atomically to the sink seam.

Formats into fixed automatic storage, rejects truncation, then delegates complete publication to cb_sink_write_all.

Parameters
[in,out]sinkDestination binding.
[in]formatprintf-compatible format string.
[in]argsFormat arguments.
Returns
k_cb_io_ok, k_cb_io_capacity, or a sink failure.
Return values
k_cb_io_okThe complete formatted record was published.
k_cb_io_capacityFormatting exceeded the fixed record capacity.
k_cb_io_faultA binding, formatting, or sink operation failed.
Precondition
sink and format are non-NULL.
args matches the conversions in format.
Postcondition
On formatting failure, no bytes are offered to sink.
On success, exactly one complete formatted record is published.
Note
The function acquires no storage and retains no va_list state.
Since
0.1.0

Definition at line 58 of file cache_bench_io.c.

References cb_sink_vformat().

Referenced by cb_sweep_block(), internal_print_verdict(), internal_report_summary(), internal_report_trace_header(), internal_report_trace_row(), internal_run_capacity(), internal_summary(), main(), priv_print_crossover(), priv_print_hot_table(), priv_print_row(), and priv_print_seq_table().

◆ cb_sink_vformat()

cb_io_status_t cb_sink_vformat ( cb_sink_t * sink,
const char * format,
va_list args )

Format one bounded record and publish it atomically to the sink seam.

Formats into fixed automatic storage, rejects truncation, then delegates complete publication to cb_sink_write_all.

Parameters
[in,out]sinkDestination binding.
[in]formatprintf-compatible format string.
[in]argsFormat arguments.
Returns
k_cb_io_ok, k_cb_io_capacity, or a sink failure.
Return values
k_cb_io_okThe complete formatted record was published.
k_cb_io_capacityFormatting exceeded the fixed record capacity.
k_cb_io_faultA binding, formatting, or sink operation failed.
Precondition
sink and format are non-NULL.
args matches the conversions in format.
Postcondition
On formatting failure, no bytes are offered to sink.
On success, exactly one complete formatted record is published.
Note
The function acquires no storage and retains no va_list state.
Since
0.1.0

Definition at line 45 of file cache_bench_io.c.

References cb_sink_write_all(), k_cb_format_capacity, k_cb_io_capacity, and k_cb_io_fault.

Referenced by cb_sink_format().

◆ cb_sink_write_all()

cb_io_status_t cb_sink_write_all ( cb_sink_t * sink,
const void * data,
size_t length )

Write every byte, retrying bounded short writes.

Repeatedly invokes the injected sink until length bytes complete, rejecting zero progress, over-counts, or the first sink failure.

Parameters
[in,out]sinkDestination binding.
[in]dataBytes to publish.
[in]lengthByte count.
Returns
k_cb_io_ok on complete publication, otherwise the first failure.
Return values
k_cb_io_okEvery byte was accepted.
k_cb_io_faultThe binding failed or the sink made invalid progress.
k_cb_io_capacityThe injected sink reported insufficient capacity.
Precondition
sink has a non-NULL write callback.
data is readable for length bytes when length is non-zero.
Postcondition
On success, exactly length bytes were published in order.
On failure, no retry occurs after the first terminal status.
Note
Atomicity beyond an individual callback is provided by the bound sink.
Since
0.1.0

Definition at line 22 of file cache_bench_io.c.

References cb_sink_t::ctx, k_cb_io_fault, k_cb_io_ok, k_cb_write_limit, and cb_sink_t::write.

Referenced by cb_sink_vformat().