heap_profile: Symlink to /tmp/heap_profile-latest.
This helps because the Upload button on pprof/ defaults to the last
directory used.
Change-Id: I71333b13e6c69fb12c749fe64e7c5f0b2a677dde
diff --git a/tools/heap_profile b/tools/heap_profile
index 23a5577..24552a3 100755
--- a/tools/heap_profile
+++ b/tools/heap_profile
@@ -210,7 +210,13 @@
subprocess.check_call(['gzip'] + [os.path.join(profile_path, x) for x in
os.listdir(profile_path)])
- print("Wrote profiles to {}".format(profile_path))
+
+ symlink_path = os.path.join(os.path.dirname(profile_path),
+ "heap_profile-latest")
+ os.unlink(symlink_path)
+ os.symlink(profile_path, symlink_path)
+
+ print("Wrote profiles to {} (symlink {})".format(profile_path, symlink_path))
print("These can be viewed using pprof. Googlers: head to pprof/ and "
"upload them.")