Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fullallocationtracker.h
Go to the documentation of this file.
1 
18 #ifndef ION_BASE_FULLALLOCATIONTRACKER_H_
19 #define ION_BASE_FULLALLOCATIONTRACKER_H_
20 
21 #include <iostream> // NOLINT
22 #include <memory>
23 
25 
26 namespace ion {
27 namespace base {
28 
32 class ION_API FullAllocationTracker : public AllocationTracker {
33  public:
35 
40  void SetTracingStream(std::ostream* s) { tracing_ostream_ = s; }
41  std::ostream* GetTracingStream() const { return tracing_ostream_; }
42 
44  void TrackAllocation(const Allocator& allocator,
45  size_t requested_size, const void* memory) override;
46  void TrackDeallocation(const Allocator& allocator,
47  const void* memory) override;
48  size_t GetAllocationCount() override;
49  size_t GetDeallocationCount() override;
50  size_t GetAllocatedBytesCount() override;
51  size_t GetDeallocatedBytesCount() override;
52  size_t GetActiveAllocationCount() override;
53  size_t GetActiveAllocationBytesCount() override;
54 
55  void SetGpuTracker(const AllocationSizeTrackerPtr& gpu_tracker) override;
56  AllocationSizeTrackerPtr GetGpuTracker() override;
57 
58  protected:
62  ~FullAllocationTracker() override;
63 
64  private:
66  class Helper;
67  std::unique_ptr<Helper> helper_;
68 
70  std::ostream* tracing_ostream_;
71 };
72 
75 
76 } // namespace base
77 } // namespace ion
78 
79 #endif // ION_BASE_FULLALLOCATIONTRACKER_H_
AllocationTracker is an abstract base class for objects that track memory.
FullAllocationTracker is a derived AllocationTracker class that keeps track of all active allocations...
void SetTracingStream(std::ostream *s)
Sets an output stream to use for tracing allocations and deallocations.
Allocator is an abstract base class for a memory allocator used for Ion objects derived from Allocata...
Definition: allocator.h:61
SharedPtr< FullAllocationTracker > FullAllocationTrackerPtr
Convenience typedef for shared pointer to a FullAllocationTracker.
A SharedPtr is a smart shared pointer to an instance of some class that implements reference counting...
Definition: sharedptr.h:60
std::ostream * GetTracingStream() const