| 1 | //===-- copyprof_state.cpp ----------------------------------------------===// |
| 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 | /// This file implements the per-thread and per-object state management for |
| 10 | /// tracking execution context within special member functions. |
| 11 | /// |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "copyprof_state.h" |
| 15 | |
| 16 | namespace __copyprof { |
| 17 | |
| 18 | THREADLOCAL PerThreadState __copyprof_state; |
| 19 | |
| 20 | void PerObjectState::SetStaticSize(usize num_bytes) { |
| 21 | tracked_size = num_bytes; |
| 22 | } |
| 23 | |
| 24 | void PerObjectState::IncreaseTrackedSize(usize num_bytes) { |
| 25 | tracked_size += num_bytes; |
| 26 | } |
| 27 | |
| 28 | usize PerObjectState::GetTrackedSize() const { return tracked_size; } |
| 29 | |
| 30 | } // namespace __copyprof |
| 31 | |