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 {
public:
RenderContext() : task::JobContext(trace_render()) {}
virtual ~RenderContext() {}
RenderArgs* args;
@ -101,7 +102,7 @@ namespace render {
protected:
RenderContextPointer _renderContext;
void run(const RenderContextPointer& context) override { assert(_renderContext); Task::run(_renderContext); }
};
using EnginePointer = std::shared_ptr<Engine>;

View file

@ -31,9 +31,13 @@ class JobNoIO {};
class JobContext {
public:
JobContext(const QLoggingCategory& category) : profileCategory(category) {
assert(category);
}
virtual ~JobContext() {}
std::shared_ptr<JobConfig> jobConfig { nullptr };
const QLoggingCategory& profileCategory;
};
using JobContextPointer = std::shared_ptr<JobContext>;
@ -163,7 +167,9 @@ public:
virtual void run(const ContextPointer& jobContext) {
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();
_concept->run(jobContext);