xref: /aosp_15_r20/external/cronet/base/android/pmf_utils.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2024 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef BASE_ANDROID_PMF_UTILS_H_
6 #define BASE_ANDROID_PMF_UTILS_H_
7 
8 #include "base/files/file.h"
9 #include "base/gtest_prod_util.h"
10 #include "base/process/process.h"
11 
12 namespace base::android {
13 
14 class BASE_EXPORT PmfUtils {
15  public:
16   static std::optional<uint64_t> GetPrivateMemoryFootprintForCurrentProcess();
17 
18  private:
19   FRIEND_TEST_ALL_PREFIXES(PmfUtilsTest, CalculatePrivateMemoryFootprint);
20   static std::optional<uint64_t> CalculatePrivateMemoryFootprintForTesting(
21       base::File& statm_file,
22       base::File& status_file);
23 };
24 
25 }  // namespace base::android
26 
27 #endif  // BASE_ANDROID_PMF_UTILS_H_
28