public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: pmachata@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM]  master: Align mismatched eventLeaves correctly
Date: Fri, 20 Jun 2008 11:47:00 -0000	[thread overview]
Message-ID: <20080620114754.11778.qmail@sourceware.org> (raw)

The branch, master has been updated
       via  ba8ffe9b1b7d9c253c93b958a7d8202c4addfa5e (commit)
      from  a9eb3c2804253d3206bc429404bffc78ecb83b4e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit ba8ffe9b1b7d9c253c93b958a7d8202c4addfa5e
Author: Petr Machata <pmachata@redhat.com>
Date:   Fri Jun 20 13:29:15 2008 +0200

    Align mismatched eventLeaves correctly
    
    * of course it would be ideal to fix underlying bugs, but for the time
      being, this serves the purpose of presenting the data to the user

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/ftrace/ChangeLog     |    5 ++++
 frysk-core/frysk/ftrace/Reporter.java |   42 +++++++++++++++++---------------
 2 files changed, 27 insertions(+), 20 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/ftrace/ChangeLog b/frysk-core/frysk/ftrace/ChangeLog
index a6f9abb..3fe6e9b 100644
--- a/frysk-core/frysk/ftrace/ChangeLog
+++ b/frysk-core/frysk/ftrace/ChangeLog
@@ -1,3 +1,8 @@
+2008-06-20  Petr Machata  <pmachata@redhat.com>
+
+	* Ftrace.java: Keep a list of event entry tokens, and align
+	eventLeave with matching eventEntry.
+
 2008-06-10  Andrew Cagney  <cagney@redhat.com>
 
 	* Ftrace.java: Use PrintDebugInfoStackOptions.
diff --git a/frysk-core/frysk/ftrace/Reporter.java b/frysk-core/frysk/ftrace/Reporter.java
index cbc95bd..6233c3f 100644
--- a/frysk-core/frysk/ftrace/Reporter.java
+++ b/frysk-core/frysk/ftrace/Reporter.java
@@ -40,6 +40,7 @@
 package frysk.ftrace;
 
 import java.util.HashMap;
+import java.util.ArrayList;
 
 import inua.util.PrintWriter;
 
@@ -53,7 +54,10 @@ class Reporter
     private PrintWriter writer;
     private Object lastItem = null;
     private Task lastTask = null;
-    private HashMap levelMap = new HashMap();
+
+    // HashMap<Task, ArrayList<Object>> -- array of entry tokens for each taks
+    private final HashMap tokenMap = new HashMap();
+
     private final PrintDebugInfoStackOptions stackPrintOptions;
     private final boolean showPC;
 
@@ -65,18 +69,14 @@ class Reporter
 	this.showPC = show;
     }
 
-    private int getLevel(Task task)
+    private ArrayList getTokens(Task task)
     {
-	int level = 0;
-	Integer l = (Integer)levelMap.get(task);
-	if (l != null)
-	    level = l.intValue();
-	return level;
-    }
-
-    private void setLevel(Task task, int level)
-    {
-	levelMap.put(task, new Integer(level));
+	ArrayList l = (ArrayList)tokenMap.get(task);
+	if (l == null) {
+	    l = new ArrayList();
+	    tokenMap.put(task, l);
+	}
+	return l;
     }
 
     private boolean lineOpened()
@@ -138,9 +138,9 @@ class Reporter
     public void eventEntry(Task task, Object item, String eventType,
 			    String eventName, Object[] args)
     {
-	int level = this.getLevel(task);
-	String spaces = ArchFormatter.repeat(' ', level);
-	this.setLevel(task, ++level);
+	ArrayList tokens = getTokens(task);
+	String spaces = ArchFormatter.repeat(' ', tokens.size());
+	tokens.add(item);
 
 	if (lineOpened())
 	    writer.println('\\');
@@ -158,13 +158,15 @@ class Reporter
     public void eventLeave(Task task, Object item, String eventType,
 			    String eventName, Object retVal)
     {
-	int level = this.getLevel(task);
-	this.setLevel(task, --level);
+	ArrayList tokens = getTokens(task);
+	int i = tokens.size();
+	while (tokens.remove(--i) != item) {
+	}
 
 	if (!myLineOpened(task, item)) {
 	    if (lineOpened())
 		writer.println();
-	    String spaces = ArchFormatter.repeat(' ', level);
+	    String spaces = ArchFormatter.repeat(' ', tokens.size());
 	    writer.print(pidInfo(task)
 			 + " " + formatTaskPC(task)
 			 + spaces + eventType
@@ -184,12 +186,12 @@ class Reporter
 
     public void eventSingle(Task task, String eventName, Object[] args)
     {
-	int level = this.getLevel(task);
+	ArrayList tokens = getTokens(task);
 	if (lineOpened())
 	    writer.println("\\");
 	writer.print(pidInfo(task)
 		     + " " + formatTaskPC(task)
-		     + ArchFormatter.repeat(' ', level)
+		     + ArchFormatter.repeat(' ', tokens.size())
 		     + eventName);
 
 	if (args != null)


hooks/post-receive
--
frysk system monitor/debugger


                 reply	other threads:[~2008-06-20 11:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080620114754.11778.qmail@sourceware.org \
    --to=pmachata@sourceware.org \
    --cc=frysk-cvs@sourceware.org \
    --cc=frysk@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).