MCPcopy Create free account
hub / github.com/apache/impala / WritePerfMapLocked

Method WritePerfMapLocked

be/src/codegen/codegen-symbol-emitter.cc:151–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151void CodegenSymbolEmitter::WritePerfMapLocked() {
152 perf_map_lock_.DCheckLocked();
153 string perf_map_path = Substitute("/tmp/perf-$0.map", getpid());
154 string tmp_perf_map_path = perf_map_path + ".tmp";
155
156 ofstream tmp_perf_map_file;
157 tmp_perf_map_file.open(tmp_perf_map_path, fstream::out | fstream::trunc);
158 if (tmp_perf_map_file.fail()) {
159 LOG(ERROR) << "Could not write perf map to: " << tmp_perf_map_path;
160 return;
161 }
162
163 for (pair<const void*, vector<PerfMapEntry>> entries: perf_map_) {
164 for (PerfMapEntry& entry: entries.second) {
165 // Write perf.map file. Each line has format <address> <size> <label>
166 tmp_perf_map_file << hex << entry.addr << " " << entry.size << " "
167 << entry.symbol << "\n";
168 }
169 }
170 tmp_perf_map_file.close();
171
172 // Atomically move the temprorary file to the new one.
173 if (rename(tmp_perf_map_path.c_str(), perf_map_path.c_str()) != 0) {
174 string err_msg = GetStrErrMsg();
175 LOG(ERROR) << "Failed to move perf map from: " << tmp_perf_map_path << " to "
176 << perf_map_path << ": " << err_msg;
177 }
178}
179
180void CodegenSymbolEmitter::EmitFunctionAsm(llvm::DIContext* debug_ctx,
181 const string& fn_symbol, uint64_t addr, uint64_t size, ofstream& asm_file) {

Callers

nothing calls this directly

Calls 5

SubstituteFunction · 0.85
GetStrErrMsgFunction · 0.85
DCheckLockedMethod · 0.80
openMethod · 0.65
closeMethod · 0.65

Tested by

no test coverage detected