P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::Coverage Namespace Reference

Classes

class  CollectNodes
 
struct  CoverageOptions
 Specifies general options and which IR nodes to track with this particular visitor. More...
 
struct  SourceIdCmp
 Utility function to compare IR nodes in a set. We use their source info. More...
 

Typedefs

using CoverageSet = std::set<const IR::Node *, SourceIdCmp>
 

Functions

void logCoverage (const CoverageSet &all, const CoverageSet &visited, const CoverageSet &new_)
 Logs nodes from new_ which have not yet been visited (are not members of visited).
 
void printCoverageReport (const CoverageSet &all, const CoverageSet &visited)
 Produces detailed final coverage log.
 

Detailed Description

This file is a collection of utilities for coverage tracking in P4 programs. Currently, this class tracks statement and constant table entry coverage. The utilities here can be used by interpreters that need to walk the IR of the P4 program and track which percentage of nodes they have visited. The p4tools (backends/p4tools) framework uses this coverage visitor.


Class Documentation

◆ P4::Coverage::CoverageOptions

struct P4::Coverage::CoverageOptions

Specifies general options and which IR nodes to track with this particular visitor.

Class Members
bool coverActions = false Cover IR::P4Action.
bool coverStatements = false Cover IR::Statement.
bool coverTableEntries = false Cover IR::Entry.
bool onlyCoveringTests = false Skip tests which do not increase coverage.

Typedef Documentation

◆ CoverageSet

using P4::Coverage::CoverageSet = std::set<const IR::Node *, SourceIdCmp>

Set of nodes used for coverage purposes. Compares nodes based on their clone_id to take node modifications into account.