add LoggingCategory data member to JobContext

This commit is contained in:
Andrew Meadows 2018-02-09 11:58:36 -08:00
parent 342ba5f8aa
commit cfb64ad693
2 changed files with 9 additions and 2 deletions

View file

@ -25,6 +25,7 @@ namespace render {
class RenderContext : public task::JobContext { class RenderContext : public task::JobContext {
public: public:
RenderContext() : task::JobContext(trace_render()) {}
virtual ~RenderContext() {} virtual ~RenderContext() {}
RenderArgs* args; RenderArgs* args;

View file

@ -31,9 +31,13 @@ class JobNoIO {};
class JobContext { class JobContext {
public: public:
JobContext(const QLoggingCategory& category) : profileCategory(category) {
assert(category);
}
virtual ~JobContext() {} virtual ~JobContext() {}
std::shared_ptr<JobConfig> jobConfig { nullptr }; std::shared_ptr<JobConfig> jobConfig { nullptr };
const QLoggingCategory& profileCategory;
}; };
using JobContextPointer = std::shared_ptr<JobContext>; using JobContextPointer = std::shared_ptr<JobContext>;
@ -163,7 +167,9 @@ public:
virtual void run(const ContextPointer& jobContext) { virtual void run(const ContextPointer& jobContext) {
PerformanceTimer perfTimer(_name.c_str()); PerformanceTimer perfTimer(_name.c_str());
//PROFILE_RANGE(render, _name.c_str()); //PROFILE_RANGE(foo, _name);
//Duration profileRangeThis(trace_foo(), name);
Duration profileRange(jobContext->profileCategory, _name.c_str());
auto start = usecTimestampNow(); auto start = usecTimestampNow();
_concept->run(jobContext); _concept->run(jobContext);