change the way dprintf works so the cache accesses required to fulfill the dprintf...
authorAli Saidi <saidi@eecs.umich.edu>
Tue, 1 May 2007 22:14:16 +0000 (18:14 -0400)
committerAli Saidi <saidi@eecs.umich.edu>
Tue, 1 May 2007 22:14:16 +0000 (18:14 -0400)
printing and the actual formatted string being printed

--HG--
extra : convert_revision : 8876ba938ba971f854bab490c9af10db039a2e83

src/kern/linux/events.cc
src/kern/linux/events.hh
src/kern/linux/printk.cc
src/kern/linux/printk.hh

index 4a3fd9f47561d31ca9d58acf89913f3552617838..42fa63a27f9ca1bc43b195f5def4bbed94a9814d 100644 (file)
@@ -37,6 +37,7 @@
 #include "kern/system_events.hh"
 #include "sim/system.hh"
 
+#include <sstream>
 
 namespace Linux {
 
@@ -44,13 +45,11 @@ void
 DebugPrintkEvent::process(ThreadContext *tc)
 {
     if (DTRACE(DebugPrintf)) {
-        if (!raw) {
-            StringWrap name(tc->getSystemPtr()->name() + ".dprintk");
-            DPRINTFN("");
-        }
-
+        std::stringstream ss;
         TheISA::Arguments args(tc);
-        Printk(args);
+        Printk(ss, args);
+        StringWrap name(tc->getSystemPtr()->name() + ".dprintk");
+        DPRINTFN("%s", ss.str());
     }
     SkipFuncEvent::process(tc);
 }
index b0510c18f53c18717117bd02161569abce9d7202..e36a72ddea2051177f3fc9488cf6fd54a37119b0 100644 (file)
@@ -38,13 +38,9 @@ namespace Linux {
 
 class DebugPrintkEvent : public SkipFuncEvent
 {
-  private:
-    bool raw;
-
   public:
-    DebugPrintkEvent(PCEventQueue *q, const std::string &desc, Addr addr,
-                     bool r = false)
-        : SkipFuncEvent(q, desc, addr), raw(r) {}
+    DebugPrintkEvent(PCEventQueue *q, const std::string &desc, Addr addr)
+        : SkipFuncEvent(q, desc, addr) {}
     virtual void process(ThreadContext *xc);
 };
 
index 0e9fd6620b79698b6f8eda187c04d2b16e36f41f..866353e313e40ebcd0f3eccf65ae6543e085ec73 100644 (file)
 #include <sys/types.h>
 #include <algorithm>
 
-#include "base/trace.hh"
 #include "arch/arguments.hh"
+#include "base/trace.hh"
+#include "kern/linux/printk.hh"
 
 using namespace std;
 
 
 void
-Printk(TheISA::Arguments args)
+Printk(stringstream &out, TheISA::Arguments args)
 {
-    std::ostream &out = Trace::output();
     char *p = (char *)args++;
 
-    ios::fmtflags saved_flags = out.flags();
-    char old_fill = out.fill();
-    int old_precision = out.precision();
-
     while (*p) {
         switch (*p) {
           case '%': {
@@ -258,8 +254,5 @@ Printk(TheISA::Arguments args)
         }
     }
 
-    out.flags(saved_flags);
-    out.fill(old_fill);
-    out.precision(old_precision);
 }
 
index 17d59b765f05ff7a8930a34cdf88ea9b89070ae3..20dfb430f2059a5ef6af8450cbc744b63c0b5cfe 100644 (file)
 
 #include "arch/isa_specific.hh"
 
+#include <sstream>
+
 class TheISA::Arguments;
 
-void Printk(TheISA::Arguments args);
+void Printk(std::stringstream &out, TheISA::Arguments args);
 
 #endif // __PRINTK_HH__