1 /* 2 * Copyright (C) 2024 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 17 #ifndef MEM_EVENTS_TEST_H_ 18 #define MEM_EVENTS_TEST_H_ 19 20 #include <inttypes.h> 21 22 #include <memevents/bpf_types.h> 23 24 /* BPF-Prog Paths */ 25 #define MEM_EVENTS_TEST_OOM_KILL_TP "/sys/fs/bpf/prog_bpfMemEventsTest_skfilter_oom_kill" 26 #define MEM_EVENTS_TEST_DIRECT_RECLAIM_START_TP \ 27 "/sys/fs/bpf/prog_bpfMemEventsTest_skfilter_direct_reclaim_begin" 28 #define MEM_EVENTS_TEST_DIRECT_RECLAIM_END_TP \ 29 "/sys/fs/bpf/prog_bpfMemEventsTest_skfilter_direct_reclaim_end" 30 #define MEM_EVENTS_TEST_KSWAPD_WAKE_TP "/sys/fs/bpf/prog_bpfMemEventsTest_skfilter_kswapd_wake" 31 #define MEM_EVENTS_TEST_KSWAPD_SLEEP_TP "/sys/fs/bpf/prog_bpfMemEventsTest_skfilter_kswapd_sleep" 32 33 // clang-format off 34 const struct mem_event_t mocked_oom_event = { 35 .type = MEM_EVENT_OOM_KILL, 36 .event_data.oom_kill = { 37 .pid = 1234, 38 .uid = 4321, 39 .process_name = "fake_process", 40 .timestamp_ms = 1, 41 .oom_score_adj = 999, 42 .total_vm_kb = 123, 43 .anon_rss_kb = 321, 44 .file_rss_kb = 345, 45 .shmem_rss_kb = 543, 46 .pgtables_kb = 6789, 47 }}; 48 49 const struct mem_event_t mocked_kswapd_wake_event = { 50 .type = MEM_EVENT_KSWAPD_WAKE, 51 .event_data.kswapd_wake = { 52 .node_id = 1, 53 .zone_id = 0, 54 .alloc_order = 2, 55 }}; 56 57 const struct mem_event_t mocked_kswapd_sleep_event = { 58 .type = MEM_EVENT_KSWAPD_SLEEP, 59 .event_data.kswapd_sleep = { 60 .node_id = 3, 61 }}; 62 // clang-format on 63 64 #endif /* MEM_EVENTS_TEST_H_ */