-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy paththreadInfo.h
More file actions
36 lines (27 loc) · 796 Bytes
/
threadInfo.h
File metadata and controls
36 lines (27 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "mutex.h"
#include "os.h"
#include <functional>
#include <map>
#include <memory>
#include <set>
#include <string>
class ThreadInfo {
private:
Mutex _ti_lock;
std::map<int, std::string> _thread_names;
std::map<int, u64> _thread_ids;
public:
// disallow copy and assign to avoid issues with the mutex
ThreadInfo(const ThreadInfo &) = delete;
ThreadInfo &operator=(const ThreadInfo &) = delete;
ThreadInfo() {}
void set(int tid, const char *name, u64 java_thread_id);
std::pair<std::shared_ptr<std::string>, u64> get(int tid);
void updateThreadName(int tid, std::function<std::string(int)> resolver);
int size();
void clearAll(std::set<int> &live_thread_ids);
void clearAll();
void reportCounters();
// For testing
int getThreadId(int threadId);
};