PerformanceStats.kt (3342B)
1 /* 2 * This file is part of GNU Taler 3 * (C) 2026 Taler Systems S.A. 4 * 5 * GNU Taler is free software; you can redistribute it and/or modify it under the 6 * terms of the GNU General Public License as published by the Free Software 7 * Foundation; either version 3, or (at your option) any later version. 8 * 9 * GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY 10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License along with 14 * GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 */ 16 17 package net.taler.wallet.settings 18 19 import kotlinx.serialization.SerialName 20 import kotlinx.serialization.Serializable 21 22 @Serializable 23 sealed class PerformanceStat { 24 abstract val avgDurationMs: Int 25 abstract val maxDurationMs: Int 26 abstract val minDurationMs: Int 27 abstract val totalDurationMs: Int 28 abstract val count: Int 29 30 @Serializable 31 @SerialName("http-fetch") 32 data class HttpFetch( 33 val url: String, 34 override val avgDurationMs: Int, 35 override val maxDurationMs: Int, 36 override val minDurationMs: Int, 37 override val totalDurationMs: Int, 38 override val count: Int, 39 ): PerformanceStat() 40 41 @Serializable 42 @SerialName("db-query") 43 data class DbQuery( 44 val name: String, 45 val location: String, 46 override val avgDurationMs: Int, 47 override val maxDurationMs: Int, 48 override val minDurationMs: Int, 49 override val totalDurationMs: Int, 50 override val count: Int, 51 ): PerformanceStat() 52 53 @Serializable 54 @SerialName("crypto") 55 data class Crypto( 56 val operation: String, 57 override val avgDurationMs: Int, 58 override val maxDurationMs: Int, 59 override val minDurationMs: Int, 60 override val totalDurationMs: Int, 61 override val count: Int, 62 ): PerformanceStat() 63 64 @Serializable 65 @SerialName("wallet-request") 66 data class WalletRequest( 67 val operation: String, 68 override val avgDurationMs: Int, 69 override val maxDurationMs: Int, 70 override val minDurationMs: Int, 71 override val totalDurationMs: Int, 72 override val count: Int, 73 ): PerformanceStat() 74 75 @Serializable 76 @SerialName("wallet-task") 77 data class WalletTask( 78 val taskId: String, 79 override val avgDurationMs: Int, 80 override val maxDurationMs: Int, 81 override val minDurationMs: Int, 82 override val totalDurationMs: Int, 83 override val count: Int, 84 ): PerformanceStat() 85 } 86 87 @Serializable 88 data class PerformanceTable( 89 @SerialName("http-fetch") 90 val httpFetch: List<PerformanceStat.HttpFetch> = emptyList(), 91 92 @SerialName("db-query") 93 val dbQuery: List<PerformanceStat.DbQuery> = emptyList(), 94 95 @SerialName("crypto") 96 val crypto: List<PerformanceStat.Crypto> = emptyList(), 97 98 @SerialName("wallet-request") 99 val walletRequest: List<PerformanceStat.WalletRequest> = emptyList(), 100 101 @SerialName("wallet-task") 102 val walletTask: List<PerformanceStat.WalletTask> = emptyList(), 103 ) 104 105 @Serializable 106 data class TestingGetPerformanceStatsResponse( 107 val stats: PerformanceTable, 108 )