]> git.sesse.net Git - casparcg/commitdiff
2.0.2: graph: Fixed bad scheduling.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 5 Dec 2011 22:21:23 +0000 (22:21 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 5 Dec 2011 22:21:23 +0000 (22:21 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.2@1799 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

common/diagnostics/graph.cpp

index 3e40b4dcb26236685dec1be54f925029eb125661..b71606f93f85a1d892f2a3e4607dab72ae12fec6 100644 (file)
@@ -58,10 +58,10 @@ class context : public drawable
 public:                                        \r
 \r
        template<typename Func>\r
-       static void begin_invoke(Func&& func) // noexcept\r
+       static void begin_invoke(Func&& func, task_priority priority) // noexcept\r
        {       \r
-               if(get_instance().executor_.size() < 1024)\r
-                       get_instance().executor_.begin_invoke(std::forward<Func>(func));        \r
+               if(get_instance().executor_.size() < 128)\r
+                       get_instance().executor_.begin_invoke(std::forward<Func>(func), priority);      \r
        }\r
 \r
        static void register_drawable(const std::shared_ptr<drawable>& drawable)\r
@@ -72,7 +72,7 @@ public:
                begin_invoke([=]\r
                {\r
                        get_instance().do_register_drawable(drawable);\r
-               });\r
+               }, high_priority);\r
        }\r
 \r
        static void show(bool value)\r
@@ -80,7 +80,7 @@ public:
                begin_invoke([=]\r
                {       \r
                        get_instance().do_show(value);\r
-               });\r
+               }, high_priority);\r
        }\r
                                \r
 private:\r
@@ -250,7 +250,7 @@ public:
 \r
                if(!tick_data_.empty())\r
                {\r
-                       float sum = *std::max_element(tick_data_.begin(), tick_data_.end()) + std::numeric_limits<float>::min();\r
+                       float sum = std::accumulate(tick_data_.begin(), tick_data_.end(), 0.0) + std::numeric_limits<float>::min();\r
                        line_data_.push_back(std::make_pair(static_cast<float>(sum)/static_cast<float>(tick_data_.size()), tick_tag_));\r
                        tick_data_.clear();\r
                }\r
@@ -391,12 +391,16 @@ void graph::set_text(const std::string& value)
        context::begin_invoke([=]\r
        {       \r
                p->set_text(value);\r
-       });\r
+       }, high_priority);\r
 }\r
 \r
 void graph::set_text(const std::wstring& value)\r
 {\r
-       set_text(narrow(value));\r
+       auto p = impl_;\r
+       context::begin_invoke([=]\r
+       {       \r
+               set_text(narrow(value));\r
+       }, high_priority);\r
 }\r
 \r
 void graph::update_value(const std::string& name, double value)\r
@@ -405,7 +409,7 @@ void graph::update_value(const std::string& name, double value)
        context::begin_invoke([=]\r
        {       \r
                p->update(name, value);\r
-       });\r
+       }, high_priority);\r
 }\r
 void graph::set_value(const std::string& name, double value)\r
 {      \r
@@ -413,7 +417,7 @@ void graph::set_value(const std::string& name, double value)
        context::begin_invoke([=]\r
        {       \r
                p->set(name, value);\r
-       });     \r
+       }, high_priority);      \r
 }\r
 void graph::set_color(const std::string& name, color c)\r
 {              \r
@@ -421,7 +425,7 @@ void graph::set_color(const std::string& name, color c)
        context::begin_invoke([=]\r
        {       \r
                p->set_color(name, c);\r
-       });\r
+       }, high_priority);\r
 }\r
 void graph::add_tag(const std::string& name)\r
 {              \r
@@ -429,7 +433,7 @@ void graph::add_tag(const std::string& name)
        context::begin_invoke([=]\r
        {       \r
                p->tag(name);\r
-       });\r
+       }, high_priority);\r
 }\r
 void graph::add_guide(const std::string& name, double value)\r
 {      \r
@@ -437,7 +441,7 @@ void graph::add_guide(const std::string& name, double value)
        context::begin_invoke([=]\r
        {       \r
                p->guide(name, value);\r
-       });\r
+       }, high_priority);\r
 }\r
 \r
 void register_graph(const safe_ptr<graph>& graph)\r