// // jet/TaskTimeFrameView.qml // // Created by Sam Gateau, 2018/06/15 // Copyright 2018 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // import QtQuick 2.7 import QtQuick.Controls 1.4 as Original import QtQuick.Controls.Styles 1.4 import "qrc:///qml/styles-uit" import "qrc:///qml/controls-uit" as HifiControls import "../jet.js" as Jet Rectangle { HifiConstants { id: hifi;} color: hifi.colors.baseGray; id: root; property var rootConfig : Workload property var jobsTree property var jobsArray Component.onCompleted: { if (!jobsTree) { jobsTree = new Array(); } if (!jobsArray) { jobsArray = new Array(); } var tfunctor = Jet.job_tree_model_array_functor(jobsTree, function(node) { var job = { "fullpath": (node.path + "." + node.name), "cpuT": 0.0, "depth": node.level } jobsArray.push(job) }) Jet.task_traverseTree(rootConfig, tfunctor); for (var j = 0; j 0) { var rangeStack =new Array() var frameDuration = Math.max(jobsArray[0].cpuT, 1) rangeStack.push( { "b": 0.0, "e": frameDuration } ) var timeScale = width * 0.9 / frameDuration; drawJob(ctx, 0, 0, jobsArray[0].cpuT, 0, timeScale) for (var i = 1; i lastDepth) { timeOffset = rangeStack[lastDepth].b while(rangeStack.length <= depth) { rangeStack.push( { "b": timeOffset, "e": duration } ) } } else { if (depth < lastDepth) { while(rangeStack.length != (depth + 1)) { rangeStack.pop() } } timeOffset = rangeStack[depth].e rangeStack[depth].b = timeOffset rangeStack[depth].e = timeOffset + duration } print("j " + i + " depth " + depth + " lastDepth " + lastDepth + " off " + timeOffset + " dur " + duration) drawJob(ctx, depth, i, duration, timeOffset, timeScale) } } } } } }