1
1
import os
2
2
import time
3
3
import json
4
- import shutil
4
+ import utility
5
5
6
6
7
7
def __get_my_dir (): return os .path .dirname (os .path .realpath (__file__ ))
@@ -109,7 +109,7 @@ def run_program_slicing(
109
109
timeout ,
110
110
verbosity
111
111
):
112
- prof = { "calling_goto_instrument " : [] }
112
+ prof = {"calling_slicer " : []}
113
113
prof_start_time = time .time ()
114
114
115
115
with open (json_cfg_fname ) as data_file :
@@ -121,8 +121,6 @@ def run_program_slicing(
121
121
src_idx_name = int (src_plain_fname [src_plain_fname .rfind ("_" )+ 1 :])
122
122
dst_goto_program_fname = os .path .join (results_dir , "sliced_goto_program_" + str (src_idx_name ) + ".gbf" )
123
123
124
- old_cwd = os .getcwd ()
125
- os .chdir (results_dir )
126
124
command = (
127
125
get_goto_instrument_pathname () + " " +
128
126
"--full-slice " +
@@ -132,16 +130,16 @@ def run_program_slicing(
132
130
)
133
131
prof_calling_goto_instrument_start_time = time .time ()
134
132
print ("Invoking 'goto-instrument' ..." )
135
- if verbosity >= 9 :
136
- print ("CWD: " + results_dir )
137
- print ("CMD: " + command )
138
- # TODO: Uncomment the next line when the slicer is functional!
139
- # os.system(command)
140
- prof ["calling_goto_instrument" ].append ({
133
+ with utility .PushCwd (results_dir ) as cwd :
134
+ if verbosity >= 9 :
135
+ print ("CWD: " + cwd .get ())
136
+ print ("CMD: " + command )
137
+ # TODO: Uncomment the next line when the slicer is functional!
138
+ # os.system(command)
139
+ prof ["calling_slicer" ].append ({
141
140
"gbf_idx" : src_idx_name ,
142
141
"duration" : time .time () - prof_calling_goto_instrument_start_time
143
142
})
144
- os .chdir (old_cwd )
145
143
146
144
result .append (cfg .copy ())
147
145
# TODO: Uncomment the next line when the slicer is functional!
0 commit comments