summaryrefslogtreecommitdiff
path: root/memory_replay/Thread.h
diff options
context:
space:
mode:
Diffstat (limited to 'memory_replay/Thread.h')
-rw-r--r--memory_replay/Thread.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/memory_replay/Thread.h b/memory_replay/Thread.h
index ffab01b4..7724c12e 100644
--- a/memory_replay/Thread.h
+++ b/memory_replay/Thread.h
@@ -14,16 +14,18 @@
* limitations under the License.
*/
-#pragma once
+#ifndef _MEMORY_REPLAY_THREAD_H
+#define _MEMORY_REPLAY_THREAD_H
#include <pthread.h>
#include <stdint.h>
#include <sys/types.h>
-// Forward Declarations.
-struct AllocEntry;
+class Action;
class Pointers;
+constexpr size_t ACTION_MEMORY_SIZE = 128;
+
class Thread {
public:
Thread();
@@ -34,13 +36,13 @@ class Thread {
void SetPending();
void ClearPending();
+ Action* CreateAction(uintptr_t key_pointer, const char* type, const char* line);
void AddTimeNsecs(uint64_t nsecs) { total_time_nsecs_ += nsecs; }
void set_pointers(Pointers* pointers) { pointers_ = pointers; }
Pointers* pointers() { return pointers_; }
- void SetAllocEntry(const AllocEntry* entry) { entry_ = entry; }
- const AllocEntry& GetAllocEntry() { return *entry_; }
+ Action* GetAction() { return reinterpret_cast<Action*>(action_memory_); }
private:
pthread_mutex_t mutex_ = PTHREAD_MUTEX_INITIALIZER;
@@ -53,7 +55,12 @@ class Thread {
Pointers* pointers_ = nullptr;
- const AllocEntry* entry_;
+ // Per thread memory for an Action. Only one action can be processed.
+ // at a time.
+ static constexpr size_t ACTION_SIZE = 128;
+ uint8_t action_memory_[ACTION_SIZE];
friend class Threads;
};
+
+#endif // _MEMORY_REPLAY_THREAD_H