stats.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //===-- stats.h -------------------------------------------------*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // Data definitions for sanitizer statistics gathering.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef SANITIZER_STATS_STATS_H
  13. #define SANITIZER_STATS_STATS_H
  14. #include "sanitizer_common/sanitizer_internal_defs.h"
  15. namespace __sanitizer {
  16. // Number of bits in data that are used for the sanitizer kind. Needs to match
  17. // llvm::kSanitizerStatKindBits in
  18. // llvm/include/llvm/Transforms/Utils/SanitizerStats.h
  19. enum { kKindBits = 3 };
  20. struct StatInfo {
  21. uptr addr;
  22. uptr data;
  23. };
  24. struct StatModule {
  25. StatModule *next;
  26. u32 size;
  27. StatInfo infos[1];
  28. };
  29. inline uptr CountFromData(uptr data) {
  30. return data & ((1ull << (sizeof(uptr) * 8 - kKindBits)) - 1);
  31. }
  32. }
  33. #endif