MCPcopy Create free account
hub / github.com/COVESA/vsomeip / check_memory

Function check_memory

test/network_tests/memory_tests/memory_test_client.cpp:14–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12#include "memory_test_client.hpp"
13
14void check_memory(std::vector<std::uint64_t>& test_memory_, std::atomic<bool>& stop_checking_) {
15 while (!stop_checking_) {
16 std::this_thread::sleep_for(MEMORY_CHECKER_INTERVAL);
17
18 static const std::uint32_t its_pagesize = static_cast<std::uint32_t>(getpagesize() / 1024);
19
20 std::FILE* its_file = std::fopen("/proc/self/statm", "r");
21 if (!its_file) {
22 VSOMEIP_ERROR << "check_memory: couldn't open: errno " << errno;
23 return;
24 }
25 std::uint64_t its_size(0);
26 std::uint64_t its_rsssize(0);
27 std::uint64_t its_sharedpages(0);
28 std::uint64_t its_text(0);
29 std::uint64_t its_lib(0);
30 std::uint64_t its_data(0);
31 std::uint64_t its_dirtypages(0);
32
33 if (EOF
34 == std::fscanf(its_file, "%lu %lu %lu %lu %lu %lu %lu", &its_size, &its_rsssize, &its_sharedpages, &its_text, &its_lib,
35 &its_data, &its_dirtypages)) {
36 VSOMEIP_ERROR << "check_memory: error reading: errno " << errno;
37 }
38 std::fclose(its_file);
39
40 test_memory_.push_back(its_rsssize * its_pagesize);
41 VSOMEIP_INFO << "logged client: " << its_rsssize * its_pagesize;
42 }
43}
44
45// Flag the desired event availability
46void memory_test_client::on_availability(vsomeip::service_t service_, vsomeip::instance_t instance_, bool is_available_) {

Callers 1

TESTFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected