[m-dev.] Please help... once more

Erwan Jahier Erwan.Jahier at irisa.fr
Fri Sep 22 06:02:03 AEDT 2000


Fergus,

I have benchmarked the Morphine/collect command on big execution traces. Here
are (roughly) the overhead I get:

with 10 000 evts there is no overhead, 
with 100 000 evts, there is a small overhead, 
...
with 2 000 000 evts, there is an overhead factor of 120, 
with 4 000 000 evts, there is an overhead factor of 230,
...

Then it seems to stabilize; with 200 000 000 events, it still have a factor
that is around 230: so at least there is a good news... )-;

I can see several reasons to that:
(1) filter is called after a long series of branches (swithes and if-then-else)
(2) filter is called after a long series functions calls: MR_trace ->
MR_trace_real -> MR_trace_event -> MR_trace_event_external.
(3) During while, a certain number of calls to functions that save and restore
registers, heaps, etc. are made to collect probably don't need:
   - restore_transient_registers(),
   - save__transient_registers(), 
   - MR_saved_global_hp(saved_regs), 
   - MR_copy_saved_regs_to_regs(), 
   - ...

So I decided to try to put the call to filter in MR_trace_real() to see what
happens (it is also a good step to make collect available from mdb BTW).
So what I have added in mercury_trace.c:MR_trace_real() looks like that (+ 
boring changes to make some symbols available from mercury_trace.c):

        
@@ -135,29 +132,6 @@
        #endif	/* MR_TRACE_HISTOGRAM */

+    switch (MR_trace_ctrl.MR_trace_cmd) {
+	case MR_CMD_COLLECT:
+             port = (MR_Trace_Port) layout->MR_sll_port;
+	      path = layout->MR_sll_entry->MR_sle_module_layout
+		    ->MR_ml_string_table + layout->MR_sll_goal_path;
+	      MR_COLLECT_filter(seqno, depth, port, layout, 
+                   path, &stop_collecting);
+	      if (stop_collecting) {
+		MR_send_collect_result();
+		MR_send_message_to_socket("execution_continuing");
+		}
+		return NULL;	
+	  
	case MR_CMD_FINISH:
         ...


Unfortunately, I run into a Bus error (I was expecting something like that,
actually...). 

I guess there are registers, or heaps, or whatever, that should be saved or 
restored, or ....

I am a bit confused about the magic incantations I should use to make it working.
Could someone (Well, I guess Fergus once more) help me?

Just in case that helps you, here is my current gdb session. 

==============================================================================
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.4"...
(gdb) b MR_COLLECT_filter
Breakpoint 1 at 0x52960: file mercury_trace_external.c, line 1486.
(gdb) r
Starting program: /home/terre/d02/lande/jahier/these/./queens

Breakpoint 1, MR_COLLECT_filter (seqno=0, depth=4290683468, port=1356800, 
    layout=0x1520d8, path=0x16 <Address 0x16 out of bounds>, 
    stop_collecting=0xff1c84c0 "") at mercury_trace_external.c:1486
1486            if (MR_collect_arguments) {
(gdb) c
Continuing.

Breakpoint 1, MR_COLLECT_filter (seqno=0, depth=0, port=MR_PORT_CALL, 
    layout=0x1, path=0x0, stop_collecting=0x0) at mercury_trace_external.c:1486
1486            if (MR_collect_arguments) {
(gdb) 
Continuing.

Breakpoint 1, MR_COLLECT_filter (seqno=2, depth=2, port=4280006636, 
    layout=0xffbeb407, path=0x2 <Address 0x2 out of bounds>, 
    stop_collecting=0xff1c8f58 "") at mercury_trace_external.c:1486
1486            if (MR_collect_arguments) {
(gdb) 
Continuing.

Breakpoint 1, MR_COLLECT_filter (seqno=2, depth=2, port=4280006636, 
    layout=0xffbeb407, path=0x2 <Address 0x2 out of bounds>, 
    stop_collecting=0xff1c8f58 "") at mercury_trace_external.c:1486
1486            if (MR_collect_arguments) {
(gdb) 
Continuing.

Breakpoint 1, MR_COLLECT_filter (seqno=3, depth=2, port=4280006636, 
    layout=0xffbeb407, path=0x2 <Address 0x2 out of bounds>, 
    stop_collecting=0xff1c8f58 "") at mercury_trace_external.c:1486
1486            if (MR_collect_arguments) {
(gdb) 
Continuing.

Breakpoint 1, MR_COLLECT_filter (seqno=4, depth=3, port=4280006636, 
    layout=0xffbeb407, path=0x3 <Address 0x3 out of bounds>, 
    stop_collecting=0xff1c8f58 "") at mercury_trace_external.c:1486
1486            if (MR_collect_arguments) {
(gdb) 
Continuing.

Breakpoint 1, MR_COLLECT_filter (seqno=4, depth=3, port=4280006636, 
    layout=0xffbeb407, path=0x3 <Address 0x3 out of bounds>, 
    stop_collecting=0xff1c8f58 "") at mercury_trace_external.c:1486
1486            if (MR_collect_arguments) {
(gdb) 
Continuing.

Program received signal SIGBUS, Bus error.
0x4e754 in _entry_mercury__queens__qdelete_3_0 () at queens.c:3455
3455            if (((Integer) r2 != (Integer) MR_mkword(MR_mktag(0), (Word *) MR_mkbody((Integer) 0))))

(gdb) bt
#0  0x4e754 in _entry_mercury__queens__qdelete_3_0 () at queens.c:3455
#1  0x105130 in MR_call_engine (entry_point=0x10cc38, 
    catch_exceptions=0 '\000') at mercury_engine.c:338
#2  0x10cafc in mercury_runtime_main () at mercury_wrapper.c:932
#3  0x4d618 in mercury_call_main () at queens_init.c:317
#4  0x4d650 in mercury_main (argc=1, argv=0xffbef064) at queens_init.c:331
#5  0x4d670 in main (argc=1, argv=0xffbef064) at queens_init.c:341


-- 
R1.


--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list