Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

jdb_tbuf.h

Go to the documentation of this file.
00001 // AUTOMATICALLY GENERATED -- DO NOT EDIT!         -*- c++ -*-
00002 
00003 #ifndef jdb_tbuf_h
00004 #define jdb_tbuf_h
00005 
00006 #include "jdb_ktrace.h"
00007 #include "l4_types.h"
00008 #include "std_macros.h"
00009 #include "tb_entry.h"
00010 
00011 //
00012 // INTERFACE definition follows 
00013 //
00014 
00015 
00016 class Context;
00017 class Log_event;
00018 class Observer;
00019 class Sys_ipc_frame;
00020 class Tracebuffer_status;
00021 
00022 class Jdb_tbuf
00023 {
00024 public:
00025   static void (*direct_log_entry)(Tb_entry*, const char*);
00026 
00027   enum
00028   { 
00029     Event  = 1,
00030     Result = 2
00031   };
00032 
00033 protected:
00034   static Tb_entry_fit   *tbuf_act;      // current entry
00035   static Tb_entry_fit   *tbuf_max;
00036   static Mword          _entries;       // number of occupied entries
00037   static Mword          _max_entries;   // maximum number of entries
00038   static Mword          _filter_enabled;// !=0 if filter is active
00039   static Mword          number;         // current event number
00040   static Mword          count_mask1;
00041   static Mword          count_mask2;
00042   static Observer       *observer;
00043 
00044 public:  
00045   static inline Tracebuffer_status * const status();
00046   
00048   static void clear_tbuf();
00049   
00051   static Tb_entry* new_entry();
00052   
00054   static void commit_entry();
00055   
00058   static inline Mword unfiltered_entries();
00059   
00060   static Mword entries();
00061   
00064   static inline Mword max_entries();
00065   
00067   static inline void max_entries(Mword num);
00068   
00072   static inline int event_valid(Mword idx);
00073   
00081   static Tb_entry* unfiltered_lookup(Mword idx);
00082   
00091   static Tb_entry* lookup(Mword look_idx);
00092   
00093   static Mword unfiltered_idx(Tb_entry *e);
00094   
00096   static Mword idx(Tb_entry *e);
00097   
00099   static inline Tb_entry* search(Mword nr);
00100   
00106   static Mword search_to_idx(Mword nr);
00107   
00114   static int event(Mword idx, Mword *number, Unsigned32 *kclock, Unsigned64 *tsc, Unsigned32 *pmc1, Unsigned32 *pmc2);
00115   
00120   static Tb_entry* ipc_pair_event(Mword idx, Unsigned8 *type);
00121   
00126   static Tb_entry* pf_pair_event(Mword idx, Unsigned8 *type);
00127   
00132   static int diff_tsc(Mword idx, Signed64 *delta);
00133   
00139   static int diff_pmc(Mword idx, Mword nr, Signed32 *delta);
00140   
00141   static inline void enable_filter();
00142   
00143   static inline void disable_filter();
00144 
00145 protected:  
00146   static inline Tb_entry_fit * const buffer();
00147 };
00148 
00149 #ifdef CONFIG_JDB_LOGGING
00150 
00151 #ifdef CONFIG_PF_UX
00152 
00153 // We don't want to patch the text segment of Fiasco-UX.
00154 
00155 #define BEGIN_LOG_EVENT(name)                                   \
00156   do                                                            \
00157     {                                                           \
00158       register Unsigned8 __do_log__;                            \
00159       asm volatile (".globl  patch_"#name"      \n\t"           \
00160                     ".data                      \n\t"           \
00161                     "patch_"#name":             \n\t"           \
00162                     ".byte   0                  \n\t"           \
00163                     ".previous                  \n\t"           \
00164                     "movb    patch_"#name",%0   \n\t"           \
00165                     : "=q"(__do_log__) );                       \
00166       if (EXPECT_FALSE( __do_log__ ))                           \
00167         {
00168 
00169 #else // ! CONFIG_PF_UX
00170 
00171 #define BEGIN_LOG_EVENT(name)                                   \
00172   do                                                            \
00173     {                                                           \
00174       register Unsigned8 __do_log__;                            \
00175       asm volatile (".globl  patch_"#name"      \n\t"           \
00176                     "patch_"#name" = .+1        \n\t"           \
00177                     "movb    $0,%0              \n\t"           \
00178                     : "=q"(__do_log__) );                       \
00179       if (EXPECT_FALSE( __do_log__ ))                           \
00180         {
00181 
00182 #endif // ! CONFIG_PF_UX
00183 
00184 #define END_LOG_EVENT                                           \
00185         }                                                       \
00186     } while (0)
00187 
00188 #else // ! CONFIG_JDB_LOGGING
00189 
00190 #define BEGIN_LOG_EVENT(name)                                   \
00191   if (0)                                                        \
00192     {
00193 
00194 #define END_LOG_EVENT                                           \
00195     }
00196 
00197 #endif // ! CONFIG_JDB_LOGGING
00198 
00199 //
00200 // IMPLEMENTATION includes follow (for use by inline functions)
00201 //
00202 
00203 #include "mem_layout.h"
00204 
00205 //
00206 // IMPLEMENTATION of inline functions (and needed classes)
00207 //
00208 
00209 
00210 
00211 
00212 inline Tracebuffer_status * const
00213 Jdb_tbuf::status()
00214 {
00215   return (Tracebuffer_status*) Mem_layout::Tbuf_status_page;
00216 }
00217 
00218 
00222 inline Mword
00223 Jdb_tbuf::unfiltered_entries()
00224 {
00225   return _entries;
00226 }
00227 
00228 
00232 inline Mword
00233 Jdb_tbuf::max_entries()
00234 {
00235   return _max_entries;
00236 }
00237 
00238 
00241 inline void
00242 Jdb_tbuf::max_entries(Mword num)
00243 {
00244   _max_entries = num;
00245 }
00246 
00247 
00252 inline int
00253 Jdb_tbuf::event_valid(Mword idx)
00254 {
00255   return (idx < _entries);
00256 }
00257 
00258 
00261 inline Tb_entry*
00262 Jdb_tbuf::search(Mword nr)
00263 {
00264   Tb_entry *e;
00265 
00266   for (Mword idx=0; (e = unfiltered_lookup(idx)); idx++)
00267     if (e->number() == nr)
00268       return e;
00269 
00270   return 0;
00271 }
00272 
00273 
00274 
00275 inline void
00276 Jdb_tbuf::enable_filter()
00277 {
00278   _filter_enabled = 1;
00279 }
00280 
00281 
00282 
00283 inline void
00284 Jdb_tbuf::disable_filter()
00285 {
00286   _filter_enabled = 0;
00287 }
00288 
00289 
00290 
00291 inline Tb_entry_fit * const
00292 Jdb_tbuf::buffer()
00293 {
00294   return (Tb_entry_fit*)Mem_layout::Tbuf_buffer_area;
00295 }
00296 
00297 #endif // jdb_tbuf_h

Generated on Mon Sep 26 14:20:11 2005 for Fiasco by  doxygen 1.4.2