[Compbench-devel] CompBenchmarks++/libcompbenchmarks/UI UI-Console.cpp, 1.3, 1.4 UI.cpp, 1.9, 1.10
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-06-13 18:11:46
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv22569 Modified Files: UI-Console.cpp UI.cpp UI.h UI-Msg.cpp UI-Msg.h Log Message: Plan related added messages. Index: UI.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI/UI.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** UI.h 6 Jun 2007 17:39:19 -0000 1.8 --- UI.h 13 Jun 2007 18:10:35 -0000 1.9 *************** *** 11,14 **** --- 11,15 ---- #include <UI/UI-Msg.h> + #include <Base/Thread.h> namespace CBM { *************** *** 23,26 **** --- 24,28 ---- UIMsg *root; UIMsg *current; + Mutex mui; virtual UIMsg *currentMsg(void); *************** *** 53,56 **** --- 55,73 ---- virtual UIMsg *msgGroup(std::string _name); + virtual UIMsg *msgPlanRegister(std::string _file, + int _default); + virtual UIMsg *msgPlanRestore(std::string _name); + virtual UIMsg *msgPlanUnregister(std::string _name); + virtual UIMsg *msgPlanBatchRegister(std::string _name); + virtual UIMsg *msgPlanBatchUnregister(std::string _name); + virtual UIMsg *msgPlanCompilerRegister(std::string _name); + virtual UIMsg *msgPlanCompilerUnregister(std::string _name); + virtual UIMsg *msgPlanOptionsetRegister(std::string _name); + virtual UIMsg *msgPlanOptionsetUnregister(std::string _name); + virtual UIMsg *msgPlanOptionsRegister(std::string _name); + virtual UIMsg *msgPlanOptionsUnregister(std::string _name); + virtual UIMsg *msgPlanBenchmarkRegister(std::string _name); + virtual UIMsg *msgPlanBenchmarkUnregister(std::string _name); + virtual UIMsg *outputInfo(std::string _text); virtual UIMsg *Progress(float _pc); Index: UI.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI/UI.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** UI.cpp 6 Jun 2007 17:39:19 -0000 1.9 --- UI.cpp 13 Jun 2007 18:10:35 -0000 1.10 *************** *** 9,13 **** #include <UI/UI.h> #include <System/System.h> - #include <Base/Thread.h> #include <libcompbenchmarks.h> --- 9,12 ---- *************** *** 19,23 **** CBM::UI *CBM::cbmUI = 0; CBM::UI *CBM::cbmUI_old = 0; - pthread_t ui_main_thread = currentThread(); UI::UI() --- 18,21 ---- *************** *** 39,49 **** void UI::postMsg(UIMsg *_msg) { ! if (ui_main_thread!=currentThread()) { ! std::cerr << "BUG : UI::postMsg() used in another thread.\n" << std::endl; ! std::cerr << "BUG : here's message : " << std::endl; ! std::cerr << _msg->str() << std::endl; ! return; ! } ! if (!current) current=root; --- 37,41 ---- void UI::postMsg(UIMsg *_msg) { ! mui.Lock(); if (!current) current=root; *************** *** 53,60 **** --- 45,54 ---- current=_msg; Display(current); + mui.Unlock(); } void UI::childDone(void) { + mui.Lock(); if (current) { DisplayDone(current); *************** *** 64,67 **** --- 58,62 ---- current=0; } + mui.Unlock(); } *************** *** 206,209 **** --- 201,310 ---- } + UIMsg *UI::msgPlanRegister(std::string _name, + int _default) + { + UIMsg *msg = new UIMsgPlanRegister(_name, _default); + postMsg(msg); + + return(msg); + } + + UIMsg *UI::msgPlanRestore(std::string _name) + { + UIMsg *msg = new UIMsgPlanRestore(_name); + postMsg(msg); + + return(msg); + } + + UIMsg *UI::msgPlanUnregister(std::string _name) + { + UIMsg *msg = new UIMsgPlanUnregister(_name); + postMsg(msg); + + return(msg); + } + + UIMsg *UI::msgPlanBatchRegister(std::string _name) + { + UIMsg *msg = new UIMsgPlanBatchRegister(_name); + postMsg(msg); + + return(msg); + } + + UIMsg *UI::msgPlanBatchUnregister(std::string _name) + { + UIMsg *msg = new UIMsgPlanBatchUnregister(_name); + postMsg(msg); + + return(msg); + } + + UIMsg *UI::msgPlanCompilerRegister(std::string _name) + { + UIMsg *msg = new UIMsgPlanCompilerRegister(_name); + postMsg(msg); + + return(msg); + } + + UIMsg *UI::msgPlanCompilerUnregister(std::string _name) + { + UIMsg *msg = new UIMsgPlanCompilerUnregister(_name); + postMsg(msg); + + return(msg); + } + + UIMsg *UI::msgPlanOptionsetRegister(std::string _name) + { + UIMsg *msg = new UIMsgPlanOptionsetRegister(_name); + postMsg(msg); + + return(msg); + } + + UIMsg *UI::msgPlanOptionsetUnregister(std::string _name) + { + UIMsg *msg = new UIMsgPlanOptionsetUnregister(_name); + postMsg(msg); + + return(msg); + } + + UIMsg *UI::msgPlanOptionsRegister(std::string _name) + { + UIMsg *msg = new UIMsgPlanOptionsRegister(_name); + postMsg(msg); + + return(msg); + } + + UIMsg *UI::msgPlanOptionsUnregister(std::string _name) + { + UIMsg *msg = new UIMsgPlanOptionsUnregister(_name); + postMsg(msg); + + return(msg); + } + + UIMsg *UI::msgPlanBenchmarkRegister(std::string _name) + { + UIMsg *msg = new UIMsgPlanBenchmarkRegister(_name); + postMsg(msg); + + return(msg); + } + + UIMsg *UI::msgPlanBenchmarkUnregister(std::string _name) + { + UIMsg *msg = new UIMsgPlanBenchmarkUnregister(_name); + postMsg(msg); + + return(msg); + } + + UIMsg *UI::outputInfo(std::string _test) { Index: UI-Msg.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI/UI-Msg.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UI-Msg.h 6 Jun 2007 21:37:59 -0000 1.3 --- UI-Msg.h 13 Jun 2007 18:10:35 -0000 1.4 *************** *** 54,58 **** PackageMake, PackageTest, PackageClean, BenchmarkBench, BenchmarkResult, ! CompilerAutodetect }; private: --- 54,64 ---- PackageMake, PackageTest, PackageClean, BenchmarkBench, BenchmarkResult, ! CompilerAutodetect, ! PlanRegister, PlanRestore, PlanUnregister, ! PlanBatchRegister, PlanBatchUnregister, ! PlanCompilerRegister, PlanCompilerUnregister, ! PlanOptionsetRegister, PlanOptionsetUnregister, ! PlanOptionsRegister, PlanOptionsUnregister, ! PlanBenchmarkRegister, PlanBenchmarkUnregister }; private: *************** *** 60,63 **** --- 66,70 ---- XMLNode *progressNode; XMLNode *childsNode; + Flags flags; virtual std::string toString(int _i); *************** *** 67,70 **** --- 74,80 ---- virtual void addObject(ObjectType _type, std::string _name); + virtual void addField(std::string _name, + std::string _value); + virtual void addAction(ActionType _type, std::string _action = ""); *************** *** 76,79 **** --- 86,90 ---- UIMsg(Flags _flags = NoProgress); + virtual Flags getFlags(void); virtual void addChild(UIMsg *_child); *************** *** 198,202 **** --- 209,299 ---- virtual ~UIMsgBench(); }; + + + + + class UIMsgPlanRegister : public UIMsg { + public: + UIMsgPlanRegister(std::string _file, + int _default); + virtual ~UIMsgPlanRegister(); + }; + + class UIMsgPlanRestore : public UIMsg { + public: + UIMsgPlanRestore(std::string _file); + virtual ~UIMsgPlanRestore(); + }; + + class UIMsgPlanUnregister : public UIMsg { + public: + UIMsgPlanUnregister(std::string _name); + virtual ~UIMsgPlanUnregister(); + }; + + class UIMsgPlanBatchRegister : public UIMsg { + public: + UIMsgPlanBatchRegister(std::string _name); + virtual ~UIMsgPlanBatchRegister(); + }; + + class UIMsgPlanBatchUnregister : public UIMsg { + public: + UIMsgPlanBatchUnregister(std::string _name); + virtual ~UIMsgPlanBatchUnregister(); + }; + + class UIMsgPlanCompilerRegister : public UIMsg { + public: + UIMsgPlanCompilerRegister(std::string _name); + virtual ~UIMsgPlanCompilerRegister(); + }; + + class UIMsgPlanCompilerUnregister : public UIMsg { + public: + UIMsgPlanCompilerUnregister(std::string _name); + virtual ~UIMsgPlanCompilerUnregister(); + }; + + class UIMsgPlanOptionsetRegister : public UIMsg { + public: + UIMsgPlanOptionsetRegister(std::string _name); + virtual ~UIMsgPlanOptionsetRegister(); + }; + + class UIMsgPlanOptionsetUnregister : public UIMsg { + public: + UIMsgPlanOptionsetUnregister(std::string _name); + virtual ~UIMsgPlanOptionsetUnregister(); + }; + class UIMsgPlanOptionsRegister : public UIMsg { + public: + UIMsgPlanOptionsRegister(std::string _name); + virtual ~UIMsgPlanOptionsRegister(); + }; + + class UIMsgPlanOptionsUnregister : public UIMsg { + public: + UIMsgPlanOptionsUnregister(std::string _name); + virtual ~UIMsgPlanOptionsUnregister(); + }; + + class UIMsgPlanBenchmarkRegister : public UIMsg { + public: + UIMsgPlanBenchmarkRegister(std::string _name); + virtual ~UIMsgPlanBenchmarkRegister(); + }; + + class UIMsgPlanBenchmarkUnregister : public UIMsg { + public: + UIMsgPlanBenchmarkUnregister(std::string _name); + virtual ~UIMsgPlanBenchmarkUnregister(); + }; + + + + + class UIMsgGroup : public UIMsg { public: Index: UI-Msg.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI/UI-Msg.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UI-Msg.cpp 6 Jun 2007 21:37:59 -0000 1.3 --- UI-Msg.cpp 13 Jun 2007 18:10:35 -0000 1.4 *************** *** 15,21 **** : XMLNode("msg") { ! if (_flags == NoProgress) addAttribute("flags", "NoProgress"); ! if (_flags == Progress) addAttribute("flags", "Progress"); --- 15,22 ---- : XMLNode("msg") { ! flags=_flags; ! if (flags == NoProgress) addAttribute("flags", "NoProgress"); ! if (flags == Progress) addAttribute("flags", "Progress"); *************** *** 25,28 **** --- 26,34 ---- } + CBM::UIMsg::Flags UIMsg::getFlags(void) + { + return(flags); + } + std::string UIMsg::toString(int _i) { *************** *** 53,56 **** --- 59,71 ---- } + void UIMsg::addField(std::string _name, + std::string _value) + { + XMLNode *O = getNode("object"); + + O->addAttribute(_name, _value); + add(O); + } + void UIMsg::addAction(ActionType _type, std::string _action) *************** *** 292,295 **** --- 307,464 ---- } + + + + UIMsgPlanRegister::UIMsgPlanRegister(std::string _file, + int _default) + : UIMsg() + { + addObject(UndefObject, _file); + addField("default", _default ? "yes" : "no"); + + addAction(PlanRegister); + } + + UIMsgPlanRegister::~UIMsgPlanRegister() + { + } + + UIMsgPlanRestore::UIMsgPlanRestore(std::string _file) + : UIMsg() + { + addObject(UndefObject, _file); + addAction(PlanRestore); + } + + UIMsgPlanRestore::~UIMsgPlanRestore() + { + } + + UIMsgPlanUnregister::UIMsgPlanUnregister(std::string _file) + : UIMsg() + { + addObject(UndefObject, _file); + addAction(PlanUnregister); + } + + UIMsgPlanUnregister::~UIMsgPlanUnregister() + { + } + + UIMsgPlanBatchRegister::UIMsgPlanBatchRegister(std::string _name) + : UIMsg() + { + addObject(UndefObject, _name); + addAction(PlanBatchRegister); + } + + UIMsgPlanBatchRegister::~UIMsgPlanBatchRegister() + { + } + + UIMsgPlanBatchUnregister::UIMsgPlanBatchUnregister(std::string _name) + : UIMsg() + { + addObject(UndefObject, _name); + addAction(PlanBatchUnregister); + } + + UIMsgPlanBatchUnregister::~UIMsgPlanBatchUnregister() + { + } + + UIMsgPlanCompilerRegister::UIMsgPlanCompilerRegister(std::string _name) + : UIMsg() + { + addObject(UndefObject, _name); + addAction(PlanCompilerRegister); + } + + UIMsgPlanCompilerRegister::~UIMsgPlanCompilerRegister() + { + } + + UIMsgPlanCompilerUnregister::UIMsgPlanCompilerUnregister(std::string _name) + : UIMsg() + { + addObject(UndefObject, _name); + addAction(PlanCompilerUnregister); + } + + UIMsgPlanCompilerUnregister::~UIMsgPlanCompilerUnregister() + { + } + + UIMsgPlanOptionsetRegister::UIMsgPlanOptionsetRegister(std::string _name) + : UIMsg() + { + addObject(UndefObject, _name); + addAction(PlanOptionsetRegister); + } + + UIMsgPlanOptionsetRegister::~UIMsgPlanOptionsetRegister() + { + } + + UIMsgPlanOptionsetUnregister::UIMsgPlanOptionsetUnregister(std::string _name) + : UIMsg() + { + addObject(UndefObject, _name); + addAction(PlanOptionsetUnregister); + } + + UIMsgPlanOptionsetUnregister::~UIMsgPlanOptionsetUnregister() + { + } + + UIMsgPlanOptionsRegister::UIMsgPlanOptionsRegister(std::string _name) + : UIMsg() + { + addObject(UndefObject, _name); + addAction(PlanOptionsRegister); + } + + UIMsgPlanOptionsRegister::~UIMsgPlanOptionsRegister() + { + } + + UIMsgPlanOptionsUnregister::UIMsgPlanOptionsUnregister(std::string _name) + : UIMsg() + { + addObject(UndefObject, _name); + addAction(PlanOptionsUnregister); + } + + UIMsgPlanOptionsUnregister::~UIMsgPlanOptionsUnregister() + { + } + + UIMsgPlanBenchmarkRegister::UIMsgPlanBenchmarkRegister(std::string _name) + : UIMsg() + { + addObject(UndefObject, _name); + addAction(PlanBenchmarkRegister); + } + + UIMsgPlanBenchmarkRegister::~UIMsgPlanBenchmarkRegister() + { + } + + UIMsgPlanBenchmarkUnregister::UIMsgPlanBenchmarkUnregister(std::string _name) + : UIMsg() + { + addObject(UndefObject, _name); + addAction(PlanBenchmarkUnregister); + } + + UIMsgPlanBenchmarkUnregister::~UIMsgPlanBenchmarkUnregister() + { + } + + + + + + UIMsgGroup::UIMsgGroup(std::string _name) : UIMsg() Index: UI-Console.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/UI/UI-Console.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UI-Console.cpp 6 Jun 2007 21:38:53 -0000 1.3 --- UI-Console.cpp 13 Jun 2007 18:10:35 -0000 1.4 *************** *** 7,10 **** --- 7,11 ---- ------------------------------------------------------------------------- */ #include <UI/UI-Console.h> + #include <libcompbenchmarks.h> #include <iostream> #include <stdlib.h> *************** *** 12,17 **** using namespace CBM; - int uiconsole_verbose_shell = 0; - UIConsole::UIConsole() : UI() --- 13,16 ---- *************** *** 34,38 **** while ((_msg) && (_msg->getParent())) { _msg=(UIMsg*)_msg->getParent()->getParent(); ! if ((uiconsole_verbose_shell) || (action(_msg)!=UIMsg::ShellCommand)) d++; --- 33,37 ---- while ((_msg) && (_msg->getParent())) { _msg=(UIMsg*)_msg->getParent()->getParent(); ! if ((UO_verbose==CBM::All) || (action(_msg)!=UIMsg::ShellCommand)) d++; *************** *** 113,117 **** for(i=0;i<n;i++) { N=R->getNode(i); ! if ((uiconsole_verbose_shell) || (action((UIMsg*)N)!=UIMsg::ShellCommand)) r++; --- 112,116 ---- for(i=0;i<n;i++) { N=R->getNode(i); ! if ((UO_verbose==CBM::All) || (action((UIMsg*)N)!=UIMsg::ShellCommand)) r++; *************** *** 123,130 **** void UIConsole::Display(UIMsg *_msg) { ! int d = depth(_msg); ! if ((!uiconsole_verbose_shell) && (action(_msg)==UIMsg::ShellCommand)) return; --- 122,134 ---- void UIConsole::Display(UIMsg *_msg) { ! int d; + if (UO_verbose==CBM::None) + return; ! d=depth(_msg); ! ! ! if ((UO_verbose!=CBM::All) && (action(_msg)==UIMsg::ShellCommand)) return; *************** *** 201,207 **** curmsg+=objectField(_msg, "name"); break; ! case UIMsg::Group: curmsg+=objectField(_msg, "name"); break; default: curmsg+="Display::DEFAULT/"; --- 205,274 ---- curmsg+=objectField(_msg, "name"); break; ! case UIMsg::Group: ! curmsg+=objectField(_msg, "name"); ! break; ! case UIMsg::PlanRegister: ! curmsg+="Registering plan "; ! curmsg+=objectField(_msg, "file"); ! break; ! case UIMsg::PlanRestore: ! curmsg+="Restoring plan "; ! curmsg+=objectField(_msg, "file"); ! break; ! case UIMsg::PlanUnregister: ! curmsg+="Unregistering plan "; ! curmsg+=objectField(_msg, "name"); ! break; ! ! case UIMsg::PlanBatchRegister: ! curmsg+="Registering batch "; ! curmsg+=objectField(_msg, "name"); ! break; ! case UIMsg::PlanBatchUnregister: ! curmsg+="Unregistering batch "; ! curmsg+=objectField(_msg, "name"); ! break; ! ! case UIMsg::PlanCompilerRegister: ! curmsg+="Registering compiler "; ! curmsg+=objectField(_msg, "name"); ! break; ! ! case UIMsg::PlanCompilerUnregister: ! curmsg+="Unregistering compiler "; ! curmsg+=objectField(_msg, "name"); ! break; ! ! case UIMsg::PlanOptionsetRegister: ! curmsg+="Registering option set "; ! curmsg+=objectField(_msg, "name"); ! break; ! ! case UIMsg::PlanOptionsetUnregister: ! curmsg+="Unregistering option set "; ! curmsg+=objectField(_msg, "name"); ! break; ! ! case UIMsg::PlanOptionsRegister: ! curmsg+="Registering options "; ! curmsg+=objectField(_msg, "name"); ! break; ! ! case UIMsg::PlanOptionsUnregister: ! curmsg+="Unregistering options "; ! curmsg+=objectField(_msg, "name"); ! break; ! ! case UIMsg::PlanBenchmarkRegister: ! curmsg+="Registering benchmark "; curmsg+=objectField(_msg, "name"); break; + + case UIMsg::PlanBenchmarkUnregister: + curmsg+="Unregistering benchmark "; + curmsg+=objectField(_msg, "name"); + break; + + default: curmsg+="Display::DEFAULT/"; *************** *** 220,224 **** void UIConsole::DisplayProgressUpdate(UIMsg *_msg) { ! if ((!uiconsole_verbose_shell) && (action(_msg)==UIMsg::ShellCommand)) return; --- 287,294 ---- void UIConsole::DisplayProgressUpdate(UIMsg *_msg) { ! if (UO_verbose==CBM::None) ! return; ! ! if ((UO_verbose!=CBM::All) && (action(_msg)==UIMsg::ShellCommand)) return; *************** *** 230,250 **** void UIConsole::DisplayDone(UIMsg *_msg) { ! XMLNode *R = _msg->getNode("output"); XMLNode *N; XMLAttribute *A; UIMsg::Status status; ! int i, n = R->nodeNumber(); ! int d = depth(_msg); ! int s; ! int p_sp = 0; ! int frc = 0; ! // std::cout << _msg->str() << std::endl; ! if ((!uiconsole_verbose_shell) && (action(_msg)==UIMsg::ShellCommand)) return; for(i=0;i<n;i++) { N=R->getNode(i); --- 300,332 ---- void UIConsole::DisplayDone(UIMsg *_msg) { ! XMLNode *R; XMLNode *N; XMLAttribute *A; UIMsg::Status status; ! int i, n; ! int d; ! int s; ! int p_sp; ! int frc; ! if (UO_verbose==CBM::None) ! return; ! ! if ((UO_verbose!=CBM::All) && (action(_msg)==UIMsg::ShellCommand)) return; + + R=_msg->getNode("output"); + + n=R->nodeNumber(); + d=depth(_msg); + p_sp = 0; + frc = 0; + + // std::cout << _msg->str() << std::endl; + for(i=0;i<n;i++) { N=R->getNode(i); *************** *** 287,296 **** if (!lastisLF) { LF(); if (d) { s=d+1; ! while (s--) ! std::cout << " "; ! p_sp=1; } } std::cout << N->Value(); --- 369,382 ---- if (!lastisLF) { LF(); + s=0; if (d) { s=d+1; ! } else { ! if (!childNumber(_msg)) ! s=1; } + while (s--) + std::cout << " "; + p_sp=1; } std::cout << N->Value(); |