Merge pull request #3158 from Tilka/perf
Linux: detect perf and default map directory to /tmp
This commit is contained in:
commit
df20326d45
|
@ -5,6 +5,7 @@
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -43,9 +44,10 @@ void Init(const std::string& perf_dir)
|
||||||
s_agent = op_open_agent();
|
s_agent = op_open_agent();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!perf_dir.empty())
|
if (!perf_dir.empty() || getenv("PERF_BUILDID_DIR"))
|
||||||
{
|
{
|
||||||
std::string filename = StringFromFormat("%s/perf-%d.map", perf_dir.data(), getpid());
|
std::string dir = perf_dir.empty() ? "/tmp" : perf_dir;
|
||||||
|
std::string filename = StringFromFormat("%s/perf-%d.map", dir.data(), getpid());
|
||||||
s_perf_map_file.Open(filename, "w");
|
s_perf_map_file.Open(filename, "w");
|
||||||
// Disable buffering in order to avoid missing some mappings
|
// Disable buffering in order to avoid missing some mappings
|
||||||
// if the event of a crash:
|
// if the event of a crash:
|
||||||
|
|
Loading…
Reference in New Issue