1/* 2 * Copyright (C) 2025 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17syntax = "proto2"; 18 19package android.os.statsd.memory; 20 21import "frameworks/proto_logging/stats/atoms.proto"; 22import "frameworks/proto_logging/stats/atom_field_options.proto"; 23import "frameworks/proto_logging/stats/enums/memory/enums.proto"; 24 25option java_package = "com.android.os.memory"; 26option java_multiple_files = true; 27 28extend Atom { 29 optional ZramMaintenanceExecuted zram_maintenance_executed = 1015 [(module) = "framework"]; 30 optional ZramSetupExecuted zram_setup_executed = 1029 [(module) = "framework"]; 31 32 optional ZramMmStatMmd zram_mm_stat_mmd = 10232 [(module) = "framework"]; 33 optional ZramBdStatMmd zram_bd_stat_mmd = 10233 [(module) = "framework"]; 34} 35 36/** 37 * Logged when zram maintenance is executed in mmd. 38 * 39 * Logged from: 40 * * system/memory/mmd 41 * 42 * Estimated Logging Rate: 43 * ZramMaintenance is triggered at most once per 1 hour 44 * 45 * Next Tag: 13 46 */ 47message ZramMaintenanceExecuted { 48 optional android.memory.ZramWritebackResult writeback_result = 1; 49 optional int64 writeback_huge_idle_pages = 2; 50 optional int64 writeback_idle_pages = 3; 51 optional int64 writeback_huge_pages = 4; 52 optional int64 writeback_latency_millis = 5; 53 optional int64 writeback_limit_kb = 6; 54 optional int64 writeback_daily_limit_kb = 7; 55 optional int64 writeback_actual_limit_kb = 8; 56 optional int64 writeback_total_kb = 9; 57 58 optional android.memory.ZramRecompressionResult recompression_result = 10; 59 optional int64 recompress_latency_millis = 11; 60 61 optional int64 interval_from_previous_seconds = 12; 62} 63 64 65/** 66 * Zram stats from /sys/block/zram0/mm_stat 67 * 68 * Logged from: 69 * * system/memory/mmd 70 * 71 * Next Tag: 10 72 */ 73message ZramMmStatMmd { 74 // Uncompressed size of data stored in this disk. This excludes 75 // same-element-filled pages (same_pages) since no memory is allocated for 76 // them. 77 optional int64 orig_data_kb = 1; 78 // Compressed size of data stored in this disk. 79 optional int64 compr_data_kb = 2; 80 // The amount of memory allocated for this disk. This includes allocator 81 // fragmentation and metadata overhead, allocated for this disk. So, 82 // allocator space efficiency can be calculated using compr_data_size and 83 // this statistic. 84 optional int64 mem_used_total_kb = 3; 85 // The maximum amount of memory ZRAM can use to store The compressed data. 86 optional int64 mem_limit_kb = 4; 87 // The maximum amount of memory zram have consumed to store the data. 88 // 89 // In zram_drv.h we define max_used_pages as atomic_long_t which could be 90 // negative, but negative value does not make sense for the variable. 91 optional int64 mem_used_max_kb = 5; 92 // The number of same element filled pages written to this disk. No memory 93 // is allocated for such pages. 94 optional int64 same_pages_kb = 6; 95 // The number of pages freed during compaction. 96 optional int64 pages_compacted_kb = 7; 97 // The number of incompressible pages. 98 // Start supporting from v4.19. 99 optional int64 huge_pages_kb = 8; 100 // The number of huge pages since zram set up. 101 // Start supporting from v5.15. 102 optional int64 huge_pages_since_kb = 9; 103} 104 105/** 106 * Zram writeback stats from /sys/block/zram0/bd_stat 107 * 108 * Logged from: 109 * * system/memory/mmd 110 * 111 * Next Tag: 4 112 */ 113message ZramBdStatMmd { 114 /// Size of data written in backing device. 115 optional int64 bd_count_kb = 1; 116 /// The number of reads from backing device. 117 optional int64 bd_reads_kb = 2; 118 /// The number of writes to backing device. 119 optional int64 bd_writes_kb = 3; 120} 121 122/** 123 * Logged when zram setup is executed in mmd. 124 * 125 * Logged from: 126 * * system/memory/mmd 127 * 128 * Estimated Logging Rate: 129 * ZramSetup is triggered at most once per boot. 130 * 131 * Next Tag: 7 132 */ 133message ZramSetupExecuted { 134 optional android.memory.ZramSetupResult zram_setup_result = 1; 135 optional android.memory.ZramCompAlgorithmSetupResult comp_algorithm_setup_result = 2; 136 optional android.memory.ZramWritebackSetupResult writeback_setup_result = 3; 137 optional android.memory.ZramRecompressionSetupResult recompression_setup_result = 4; 138 optional int64 zram_size_mb = 5; 139 optional int64 writeback_size_mb = 6; 140} 141