/*
- * Copyright 2018 Samsung Electronics Co., Ltd
+ * Copyright 2018-2019 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the License);
* you may not use this file except in compliance with the License.
class HeapTracer {
public:
- HeapTracer();
- virtual ~HeapTracer();
+ HeapTracer();
+ virtual ~HeapTracer();
- bool Insert(void *ptr, std::string description, size_t size = 0);
- bool Delete(void *ptr, std::string description);
- std::string Find(void *ptr);
+ bool Insert(void *ptr, std::string description, size_t size = 0);
+ bool Delete(void *ptr, std::string description);
+ std::string Find(void *ptr);
- void MarkUnmanaged(void *ptr, std::string description);
+ void MarkUnmanaged(void *ptr, std::string description);
- bool Empty();
- void Trace();
+ bool Empty();
+ void Trace();
protected:
- typedef struct {
- void *ptr{nullptr};
- std::string description;
- int size{0};
- } AllocationEntry;
+ typedef struct {
+ void *ptr{nullptr};
+ std::string description;
+ int size{0};
+ } AllocationEntry;
- std::mutex mManagedTableMutex;
- std::unordered_map<void*, AllocationEntry> mManagedTable;
+ std::mutex mManagedTableMutex;
+ std::unordered_map<void*, AllocationEntry> mManagedTable;
- std::mutex mUnmanagedRecordsMutex;
- std::list<AllocationEntry> mUnmanagedRecords;
- size_t mUnmanagedRecordsSize{0};
+ std::mutex mUnmanagedRecordsMutex;
+ std::list<AllocationEntry> mUnmanagedRecords;
+ size_t mUnmanagedRecordsSize{0};
- enum class EntryOperation {
- INSERT,
- DELETE,
- };
- typedef struct {
- AllocationEntry entry;
- EntryOperation operation;
- struct timespec ts;
- } EntryHistory;
- std::list<EntryHistory> mEntryHistory;
+ enum class EntryOperation {
+ INSERT,
+ DELETE,
+ };
+ typedef struct {
+ AllocationEntry entry;
+ EntryOperation operation;
+ struct timespec ts;
+ } EntryHistory;
+ std::list<EntryHistory> mEntryHistory;
};
#endif /* __HEAP_TRACER_H__ */
\ No newline at end of file