diff options
author | Ben Cheng <bccheng@google.com> | 2009-10-07 12:28:49 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2009-10-07 12:28:49 -0700 |
commit | d6eeae3f5dd027a2d4e6b702cc07db4a605848c0 (patch) | |
tree | 2cf361b308f14d09ff39c755302376059c232bfb | |
parent | 1434507eb3c837aa83306fca335f49d5ad3dec4e (diff) | |
download | oprofile-eclair-passion-release.tar.gz |
Select the proper version of OProfile tools based on host OS information.android-sdk-tools_r4android-sdk-tools_r3android-sdk-2.1_r1android-sdk-2.0_r1android-sdk-2.0.1_r1android-sdk-2.0.1-docs_r1android-2.1_r2.1sandroid-2.1_r2.1p2android-2.1_r2.1pandroid-2.1_r2android-2.1_r1android-2.0_r1android-2.0.1_r1eclair-sholes-release2eclair-sholes-releaseeclair-releaseeclair-passion-release
android-bc_triage 2162989
-rwxr-xr-x | opimport_pull | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/opimport_pull b/opimport_pull index 7dbac4a..bc443ec 100755 --- a/opimport_pull +++ b/opimport_pull @@ -5,26 +5,48 @@ import re import sys def PrintUsage(): - print "Usage:" + sys.argv[0] + " dir" + print "Usage:" + sys.argv[0] + " [-r] dir" + print " -r : reuse the directory if it already exists" print " dir: directory on the host to store profile results" -if (len(sys.argv) != 2): +if (len(sys.argv) > 3): PrintUsage() sys.exit(1) +# identify 32-bit vs 64-bit platform +stream = os.popen("uname -m") +arch_name = stream.readline().rstrip("\n"); +stream.close() + +# default path is prebuilt/linux-x86/oprofile +# for 64-bit OS, use prebuilt/linux-x86_64/oprofile instead +if arch_name == "x86_64": + arch_path = "/../../linux-x86_64/oprofile" +else: + arch_path = "" + try: oprofile_event_dir = os.environ['OPROFILE_EVENTS_DIR'] except: print "OPROFILE_EVENTS_DIR not set. Run \". envsetup.sh\" first" sys.exit(1) -output_dir = sys.argv[1]; +if sys.argv[1] == "-r" : + replace_dir = 1 + output_dir = sys.argv[2] +else: + replace_dir = 0 + output_dir = sys.argv[1] + +if (os.path.exists(output_dir) and (replace_dir == 1)): + os.system("rm -fr " + output_dir) try: os.makedirs(output_dir) except: if os.path.exists(output_dir): print "Directory already exists:", output_dir + print "Try \"" + sys.argv[0] + " -r " + output_dir + "\"" else: print "Cannot create", output_dir sys.exit(1) @@ -60,11 +82,12 @@ for line in stream: if not os.path.exists(dir): os.makedirs(dir) - cmd = oprofile_event_dir + "/bin/opimport -a " + oprofile_event_dir + \ + cmd = oprofile_event_dir + arch_path + "/bin/opimport -a " + \ + oprofile_event_dir + \ "/abi/arm_abi -o samples" + middle_part + "/" + file_name + " " + line os.system(cmd) stream.close() # short summary of profiling results -os.system(oprofile_event_dir + "/bin/opreport --session-dir=.") +os.system(oprofile_event_dir + arch_path + "/bin/opreport --session-dir=.") |