| 44 | } |
| 45 | |
| 46 | std::shared_ptr<InstrumentContext> InstrumentContext::Instance(CUcontext ctx) |
| 47 | { |
| 48 | static std::mutex ctx_mtx; |
| 49 | static std::map<CUcontext, std::shared_ptr<InstrumentContext>> ctx_map; |
| 50 | |
| 51 | std::lock_guard<std::mutex> lock(ctx_mtx); |
| 52 | auto it = ctx_map.find(ctx); |
| 53 | if (it != ctx_map.end()) return it->second; |
| 54 | |
| 55 | auto instr_ctx = std::make_shared<InstrumentContext>(ctx); |
| 56 | ctx_map[ctx] = instr_ctx; |
| 57 | return instr_ctx; |
| 58 | } |
| 59 | |
| 60 | CUresult InstrumentContext::Launch(std::shared_ptr<CudaKernelCommand> kernel, |
| 61 | CUstream stream, LaunchType type) |
nothing calls this directly
no outgoing calls
no test coverage detected