On Sun, Jan 9, 2011 at 6:09 AM, Timothy Hayes <[email protected]> wrote:
> Thanks for this. I don't think it's working quite right though. When I call
> '-kill', it does close the QEMU window but my stats file is incomplete
> (<4MB) and ptlstats can't extract the final snapshot.
>
> Yes. I have attached the new patch that fixes this issue. Apply it on top
of previous patch.
> Maybe you can advise me here; I'm following the PTLsim suggestion and
> trying to skip over "boring" parts of my application. I would like to wrap
> important kernels between calls to ptlcall_switch_to_sim()
> and ptlcall_switch_to_native(). When the application runs to completion I
> would like the stop the simulation entirely and flush my log and
> stats. Since ptlcall_switch_to_native() wasn't functioning correctly I
> replaced it with ptlcall_single_flush("-stop") hoping for a similar effect.
> Maybe this is where I'm making a mistake?
>
> Try out this new patch, it should flush stats and logs when its killing the
simulator so it should work now.
- Avadh
> Kind regards
> Tim
>
> On 7 January 2011 22:01, avadh patel <[email protected]> wrote:
>
>>
>> On Fri, Jan 7, 2011 at 11:27 AM, Timothy Hayes <[email protected]> wrote:
>>
>>> Thanks for the swift reply.
>>>
>>> Yes, the '-stop' causes it to return to emulation mode. The '-kill' is
>>> thus given in emulation mode too. I was hoping I could wrap functions of
>>> interest in '-run' & '-stop' statements and then flush the stats/logfile at
>>> the end of the program's execution by using '-kill'.
>>>
>>> I have attached a patch that will check '-kill' flag and kill the
>> simulation process even if its in emulation mode.
>> I haven't tested it because currently I dont have access to any setup on
>> which I can test it. Let me know if this works then I can patch to master
>> branch.
>>
>>
>>> By the way, is there a way to do the above without using '-kill'? It
>>> would be nice to run several benchmarks & recalling simconfig without having
>>> to reboot the MARSS environment each time.
>>>
>>> Currently there is no method to do that but way we work is we create
>> checkpoint for each benchmark and then use a script to run each benchmark
>> one after another.
>> You can find this script to run checkpoints here:
>> https://github.com/downloads/avadhpatel/marss/run_bench.py
>> Or you can click on 'Downloads' on github and it will show up.
>>
>> - Avadh
>>
>> Kind regards
>>> Tim
>>>
>>>
>>> On 7 January 2011 18:40, avadh patel <[email protected]> wrote:
>>>
>>>> I guess I found the issue. When '-kill' is issued if Marss is not in
>>>> simulation mode it will no kill the whole process. The fix is to kill the
>>>> process when we saw '-kill' signal in 'plt_machine_configure'.
>>>>
>>>> Please can you answer the following two questions so I can clearly set
>>>> the scenario as you mentioned and fix this issue in master branch.
>>>>
>>>> 1. When you give '-stop' does it switch to emulation mode and keep
>>>> running or it stops the emulation also?
>>>> 2. When '-kill' is given is it running in emulation mode or simulation?
>>>>
>>>> Thanks,
>>>> Avadh
>>>>
>>>> On Fri, Jan 7, 2011 at 9:41 AM, Timothy Hayes <[email protected]> wrote:
>>>>
>>>>> Hello
>>>>>
>>>>> I've started using MARSS for a research project, my thanks to all of
>>>>> you involved for a great piece of software.
>>>>>
>>>>> I have a question regarding switching between simulated and native
>>>>> modes. I would like to execute my program in full and wrap the significant
>>>>> kernels in 'ptlcall_switch_to_sim()' and 'ptlcall_switch_to_native()'. The
>>>>> former works fine but when I call the latter, MARSS informs:
>>>>> MARSSx86::Command received : -native
>>>>> Warning: invalid option '-native'
>>>>>
>>>>> I've tried using 'ptlcall_single_flush("-stop")' in lieu of -native,
>>>>> but when I try to do 'ptlcall_kill()' at the end of the program's
>>>>> execution,
>>>>> MARSS informs:
>>>>> MARSSx86::Command received : -kill
>>>>> Warning: only one action (from -run, -stop, -kill) can be specified at
>>>>> once
>>>>>
>>>>> This is problematic as the final snapshot isn't written to my stats
>>>>> file. Can you advise me the typical way users circumvent this issue?
>>>>>
>>>>> Kind regards
>>>>> Tim
>>>>>
>>>>> p.s. this naturally leads me to ask if I can run multiple benchmarks
>>>>> with different logfiles/stats without having to kill and restart the SUT
>>>>> each time?
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> http://www.marss86.org
>>>>> Marss86-Devel mailing list
>>>>> [email protected]
>>>>> https://www.cs.binghamton.edu/mailman/listinfo/marss86-devel
>>>>>
>>>>>
>>>>
>>>
>>
>
diff --git a/ptlsim/sim/ptlsim.cpp b/ptlsim/sim/ptlsim.cpp
index 17a041f..b133e5d 100644
--- a/ptlsim/sim/ptlsim.cpp
+++ b/ptlsim/sim/ptlsim.cpp
@@ -65,7 +65,8 @@ const char *snapshot_names[] = {"user", "kernel", "global"};
#endif
-void kill_simulation() __attribute__((noreturn));
+static void kill_simulation() __attribute__((noreturn));
+static void write_mongo_stats();
void PTLsimConfig::reset() {
help=0;
@@ -414,15 +415,38 @@ void capture_stats_snapshot(const char* name) {
statswriter.write(stats, name);
}
-void flush_stats() {
- statswriter.flush();
-}
-
void print_sysinfo(ostream& os) {
// TODO: In QEMU based system
}
-void kill_simulation()
+static void flush_stats()
+{
+ if(config.screenshot_file.buf != "") {
+ qemu_take_screenshot((char*)config.screenshot_file);
+ }
+
+ const char *user_name = "user";
+ strncpy(user_stats.snapshot_name, snapshot_names[0], sizeof(user_name));
+ user_stats.snapshot_uuid = statswriter.next_uuid();
+ statswriter.write(&user_stats, user_name);
+
+ const char *kernel_name = "kernel";
+ strncpy(kernel_stats.snapshot_name, snapshot_names[1], sizeof(kernel_name));
+ kernel_stats.snapshot_uuid = statswriter.next_uuid();
+ statswriter.write(&kernel_stats, kernel_name);
+
+ const char *global_name = "final";
+ strncpy(global_stats.snapshot_name, snapshot_names[2], sizeof(global_name));
+ global_stats.snapshot_uuid = statswriter.next_uuid();
+ statswriter.write(&global_stats, global_name);
+
+ statswriter.close();
+
+ if(config.enable_mongo)
+ write_mongo_stats();
+}
+
+static void kill_simulation()
{
assert(config.kill || config.kill_after_run);
@@ -624,6 +648,7 @@ extern "C" void ptl_machine_configure(const char* config_str_) {
}
if(config.kill) {
+ flush_stats();
kill_simulation();
}
@@ -899,7 +924,7 @@ void setup_ptlsim_switch_all_ctx(Context& last_ctx) {
void add_bson_PTLsimStats(PTLsimStats *stats, bson_buffer *bb, const char *snapshot_name);
/* Write all the stats to MongoDB */
-void write_mongo_stats() {
+static void write_mongo_stats() {
bson bout;
bson_buffer bb;
char numstr[4];
@@ -1114,29 +1139,7 @@ extern "C" uint8_t ptl_simulate() {
cerr << endl;
print_stats_in_log();
- if(config.screenshot_file.buf != "") {
- qemu_take_screenshot((char*)config.screenshot_file);
- }
-
- const char *user_name = "user";
- strncpy(user_stats.snapshot_name, snapshot_names[0], sizeof(user_name));
- user_stats.snapshot_uuid = statswriter.next_uuid();
- statswriter.write(&user_stats, user_name);
-
- const char *kernel_name = "kernel";
- strncpy(kernel_stats.snapshot_name, snapshot_names[1], sizeof(kernel_name));
- kernel_stats.snapshot_uuid = statswriter.next_uuid();
- statswriter.write(&kernel_stats, kernel_name);
-
- const char *global_name = "final";
- strncpy(global_stats.snapshot_name, snapshot_names[2], sizeof(global_name));
- global_stats.snapshot_uuid = statswriter.next_uuid();
- statswriter.write(&global_stats, global_name);
-
- statswriter.close();
-
- if(config.enable_mongo)
- write_mongo_stats();
+ flush_stats();
if(config.kill || config.kill_after_run) {
kill_simulation();
diff --git a/ptlsim/sim/ptlsim.h b/ptlsim/sim/ptlsim.h
index efa83d7..d157f6d 100644
--- a/ptlsim/sim/ptlsim.h
+++ b/ptlsim/sim/ptlsim.h
@@ -120,7 +120,6 @@ struct TransOpBuffer {
void split_unaligned(const TransOp& transop, TransOpBuffer& buf);
void capture_stats_snapshot(const char* name = null);
-void flush_stats();
bool handle_config_change(PTLsimConfig& config, int argc = 0, char** argv = null);
void collect_common_sysinfo(PTLsimStats& stats);
void collect_sysinfo(PTLsimStats& stats, int argc, char** argv);
_______________________________________________
http://www.marss86.org
Marss86-Devel mailing list
[email protected]
https://www.cs.binghamton.edu/mailman/listinfo/marss86-devel