001/* 002 * Copyright © 2025 CUI-OpenSource-Software (info@cuioss.de) 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package de.cuioss.benchmarking.common.report; 017 018import static de.cuioss.benchmarking.common.constants.BenchmarkConstants.Report.Errors.*; 019 020/** 021 * Immutable record containing all computed benchmark metrics. 022 * This is the central data structure shared across all report generators. 023 */ 024public record BenchmarkMetrics( 025String throughputBenchmarkName, 026String latencyBenchmarkName, 027double throughput, 028double latency, 029double performanceScore, 030String performanceGrade 031) { 032 public BenchmarkMetrics { 033 if (throughputBenchmarkName == null || throughputBenchmarkName.isBlank()) { 034 throw new IllegalArgumentException(THROUGHPUT_NAME_REQUIRED); 035 } 036 if (latencyBenchmarkName == null || latencyBenchmarkName.isBlank()) { 037 throw new IllegalArgumentException(LATENCY_NAME_REQUIRED); 038 } 039 if (throughput <= 0) { 040 throw new IllegalArgumentException(THROUGHPUT_POSITIVE + throughput); 041 } 042 if (latency <= 0) { 043 throw new IllegalArgumentException(LATENCY_POSITIVE + latency); 044 } 045 if (performanceScore < 0) { 046 throw new IllegalArgumentException(SCORE_NON_NEGATIVE + performanceScore); 047 } 048 } 049}