ProfileFormatter

scalus.uplc.eval.ProfileFormatter

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def loadSources(data: ProfilingData, include: String => Boolean = ...): Map[String, IndexedSeq[String]]

Source files referenced by data, loaded best-effort (only files readable from the current working directory) so the HTML report can annotate them with per-line cost.

Source files referenced by data, loaded best-effort (only files readable from the current working directory) so the HTML report can annotate them with per-line cost.

Value parameters

include

keep only files whose path satisfies this predicate. Use it to skip framework/library sources and annotate only your own contract — e.g. !_.contains("/scalus-core/"). For projects that depend on Scalus as a published artifact, library sources live in jars and are already excluded (they are not readable files).

Attributes

def summary(data: ProfilingData, topN: Int = ...): String

Compact summary suitable for console / log output: total budget plus the top-N by CPU.

Compact summary suitable for console / log output: total budget plus the top-N by CPU.

Attributes

def toCsv(data: ProfilingData): String

Renders profiling data as CSV (one diffable file across all sections). When the data carries execution unit prices, a trailing fee column (lovelace) is added.

Renders profiling data as CSV (one diffable file across all sections). When the data carries execution unit prices, a trailing fee column (lovelace) is added.

Attributes

def toHtml(data: ProfilingData): String

Renders profiling data as a self-contained HTML page (no source annotation).

Renders profiling data as a self-contained HTML page (no source annotation).

Attributes

def toHtml(data: ProfilingData, sources: Map[String, IndexedSeq[String]], title: String = ...): String

Renders profiling data as a self-contained, interactive HTML page.

Renders profiling data as a self-contained, interactive HTML page.

The page bundles its own CSS/JS (no external dependencies): sortable, filterable tables with %-of-CPU bars, a cost-ranked hot-edges table, and — when source text is supplied — a per-line cost-annotated source view (the flagship view).

Value parameters

data

the profiling data

sources

optional file -> source lines (line n is element n - 1); profiled files present here are rendered with per-line cost annotations

title

optional label identifying what was profiled (e.g. the contract and test-case name). When non-empty it is shown in the page <title> and as a subtitle above the report.

Attributes

def toJson(data: ProfilingData): String

Renders the full profiling data as JSON (machine-readable). When the data carries execution unit prices, every entry and the total also include a derived "fee" in lovelace.

Renders the full profiling data as JSON (machine-readable). When the data carries execution unit prices, every entry and the total also include a derived "fee" in lovelace.

Attributes

def toText(data: ProfilingData, maxRows: Int = ...): String

Renders profiling data as a formatted text table.

Renders profiling data as a formatted text table.

Value parameters

data

The profiling data

maxRows

Maximum rows to display per section (default 50)

Attributes

Returns

Formatted text output

def writeCsv(data: ProfilingData, path: String): Unit

Write the CSV rendering to path (creating parent dirs).

Write the CSV rendering to path (creating parent dirs).

Attributes

def writeHtml(data: ProfilingData, path: String, include: String => Boolean = ..., title: String = ...): Unit

Write a self-contained, source-annotated HTML report to path (creating parent dirs).

Write a self-contained, source-annotated HTML report to path (creating parent dirs).

Value parameters

include

source-file filter for the annotated-source view (see loadSources)

title

optional label identifying what was profiled (e.g. the contract and test-case name); shown in the page <title> and as a subtitle above the report (see toHtml)

Attributes

def writeJson(data: ProfilingData, path: String): Unit

Write the JSON rendering to path (creating parent dirs).

Write the JSON rendering to path (creating parent dirs).

Attributes