Date: | Wed, 31 Aug 2011 23:01:07 -0400 |
---|---|
From: | "abhisekpan@xxxxxxxxx" <abhisekpan@xxxxxxxxx> |
Subject: | [Gems-users] Tracking one specific binary in ruby |
Hi folks! I am trying to track only one specific binary in ruby, while the simulated system in simics runs multiple processes, including those of the OS. Do you guys have some idea how it can be done? This is for linux on x86. I came up with a technique, where I created two new ruby commands, enable and disable. In disabled mode, all requests are unhandled ie. the unhandled request check always returns true in disabled mode. Then I used a Linux process tracker, which basically monitors the exec calls, and gets the process id for the binary we want to track, and then enables and disables ruby when that process is active or inactive respectively. I think this works, but I am not sure. However now the problem is I plan to load ruby after simics halts on a magic-breakpoint form the binary itself (binaries are parsec benchmarks and I load ruby on the entrance of ROI). Hence when ruby loads the exec call has already been done. So the scheme does not work it seems. Plase let me know if you have any ideas. The python code for the linux tracker is given below. Is there a simpler way to do this? Thanks for the help! -- Abhisek Live Long and Prosper ========================================================================= from sim_core import * from sys import exit if not(simenv.bm2track): print("Please set the cli variable bm2track with the name of the benchmark to track with ruby") exit() else: print("Tracking benchmark", simenv.bm2track, "with ruby...") #Load a new linux process tracker eval_cli_line("new-linux-process-tracker name = tracker0") eval_cli_line("tracker0.add-processor cpu0") eval_cli_line("tracker0.add-processor cpu1") eval_cli_line("tracker0.add-processor cpu2") eval_cli_line("tracker0.add-processor cpu3") eval_cli_line("tracker0.add-processor cpu4") eval_cli_line("tracker0.add-processor cpu5") eval_cli_line("tracker0.add-processor cpu6") eval_cli_line("tracker0.add-processor cpu7") eval_cli_line("tracker0.autodetect-parameters") #enable magic breakpoint eval_cli_line("magic-break-enable") #Activate Tracker eval_cli_line("tracker0.activate") # match ruby and simics memory, it is not matched ########## # prepare and load ruby eval_cli_line("instruction-fetch-mode instruction-fetch-trace") eval_cli_line("istc-disable") eval_cli_line("dstc-disable") eval_cli_line("cpu-switch-time 1") eval_cli_line("load-module ruby") eval_cli_line("ruby0.setparam g_NUM_PROCESSORS 8") eval_cli_line("ruby0.setparam g_MEMORY_SIZE_BYTES 4294967296") #Initialize ruby, disabled mode eval_cli_line("ruby0.init") bm2track=simenv.bm2track start_trace = False; def exec_hap(user_arg, tracker, tid, cpu, binary): global start_trace global bm2track print (binary) if binary.endswith(bm2track): def active_hap(user_arg, tracker, tid, cpu, active): global start_trace if active and start_trace: eval_cli_line("ruby0.enable") print ("ruby enabled") else: eval_cli_line("ruby0.disable") SIM_hap_add_callback_obj_index("Core_Trackee_Active", tracker, 0, active_hap, None, tid) SIM_hap_add_callback_obj("Core_Trackee_Exec", conf.tracker0, 0, exec_hap, None) def hap_callback(user_arg, cpu, arg): global start_trace print "Magic callback" start_trace= not(start_trace) if (start_trace==False): eval_cli_line("ruby0.disable") SIM_break_simulation("snore") SIM_hap_add_callback("Core_Magic_Instruction", hap_callback, None) ========================================================================== |
[← Prev in Thread] | Current Thread | [Next in Thread→] |
---|---|---|
|
Previous by Date: | [Gems-users] Memory fence, Hao Lin |
---|---|
Next by Date: | , (nil) |
Previous by Thread: | [Gems-users] ruby compile error, Mohammad j. Ranji |
Next by Thread: | [Gems-users] what is the garnet ruby interface, jianhual |
Indexes: | [Date] [Thread] |