         
syntax = "proto2";
package NV.RuleSystem;
import "ProfilerSection/ProfilerSection.proto";
// =============================================================================
// MESSAGE
// Simple message that stores a single string
//
// TYPES
// None         - No message available
// Ok           - Informative, non-actionable message
// Warning      - Non-fatal warnings, e.g. about as missing metrics
// Error        - Execution errors/failures during rule execution,
//                e.g. syntax error in Python script
// Optimization - Message about performance optimization potential;
//                should be actionable
// =============================================================================
enum RuleResultMessageType
{
    None = 0;
    Ok = 1;
    Warning = 2;
    Error = 3;
    Optimization = 4;
}
message RuleResultMessage
{
    required string Message = 1;
    required RuleResultMessageType Type = 2;
    optional int32 Id = 3;
    optional string Name = 4;
}
message RuleResultProposal
{
    required string Identifier = 1;
}
// =============================================================================
// POTENTIAL SPEEDUP
// Stores SpeedupType and Value of the estimated maximal achievable speedup
//
// TYPE
// Unknown - not set
// Local - value represents increase in hardware efficiency in isolated context
// Global - value represents decrease in overall kernel runtime
// 
// VALUE
// Expected to be in the range [0, 100], as it represents a percentage
// =============================================================================
enum RuleResultSpeedupType
{
    Unknown = 0;
    Local = 1;
    Global = 2;
}
message RuleResultSpeedup
{
    optional RuleResultSpeedupType SpeedupType = 1;
    optional double Value = 2;
}
enum RuleResultFocusSeverity
{
    Default = 0;
    Low = 1;
    High = 2;
}
message RuleResultFocusMetric
{
    optional int32 MessageId = 1;
    optional string MetricName = 2;
    optional double MetricValue = 3;
    optional RuleResultFocusSeverity Severity = 4;
    optional string Info = 5;
}
// =============================================================================
// SOURCEMARKER
// Icon and tooltip text that gets shown on lines in the Source Page
// =============================================================================
enum MarkerKind
{
    SASS = 0;
    Source = 1;
}
message SourceMarker
{
    optional MarkerKind Kind = 1;
    oneof source_location
    {
        uint32 LineNumber = 2;
        uint64 Address = 3;
    }
    optional string Tooltip = 4;
    optional RuleResultMessageType Type = 5;
    optional string FileName = 6;
}
// =============================================================================
// BODY ITEM
// A single body item
// =============================================================================
message RuleResultBodyItem
{
    optional RuleResultMessage Message = 1;
    optional NV.Profiler.ProfilerSectionTable Table = 2;
    optional NV.Profiler.ProfilerSectionBarChart BarChart = 3;
    optional NV.Profiler.ProfilerSectionHistogramChart HistogramChart = 4;
    optional NV.Profiler.ProfilerSectionLineChart LineChart = 5;
    optional RuleResultProposal Proposal = 6;
    optional NV.Profiler.ProfilerSectionRooflineChart RooflineChart = 7;
    repeated RuleResultFocusMetric FocusMetrics = 8;
    optional NV.Profiler.ProfilerSourceMetricTable SourceMetricTable = 9;
    optional RuleResultSpeedup Speedup = 10;
    optional NV.Profiler.ProfilerSuffixTable SuffixTable = 11;
}
// =============================================================================
// BODY
// Any number of items that are shows when the results are expanded
// =============================================================================
message RuleResultBody
{
    repeated RuleResultBodyItem Items = 1;
}
// =============================================================================
// RESULT
// =============================================================================
message RuleResult
{
    required string Identifier = 1;
    required string DisplayName = 2;
    optional RuleResultBody Body = 3;
    optional string SectionIdentifier = 4;
    repeated SourceMarker SourceMarkers = 5;
}
message RuleResults
{
    repeated RuleResult RuleResults = 1;
}
