<commit_before>const isBrowser = !require('is-plask')
const log = require('debug')('profiler')
let canvas = null
let ctx2d = null
const W = 250
const H = 800
const M = 10
const LINE_H = 16
const FONT_H = 11
const FONT = FONT_H + 'px Droid Sans Mono, Andale Mono, monospace'

function ms (time) {
  var f = Math.floor(time * 10) / 10
  var s = '' + f
  if (f % 1 === 0) s += '.0'
  if (f < 10) s = ' ' + s
  return s + ''
}

function pa3 (f) {
  if (f < 10) return '  ' + f
  if (f < 100) return ' ' + f
  return f
}

function createProfiler (ctx) {
  const gl = ctx.gl
  if (isBrowser && !canvas) {
    canvas = document.createElement('canvas')
    canvas.width = W * 2
    canvas.height = H * 2
    document.body.appendChild(canvas)
    canvas.style.position = 'fixed'
    canvas.style.width = W + 'px'
    canvas.style.height = H + 'px'
    canvas.style.top = M + 'px'
    canvas.style.right = M + 'px'
    canvas.style.zIndex = 1000
    ctx2d = canvas.getContext('2d')
  }

  const profiler = {
    frame: 0,<commit_msg>Store reference to profiler canvas<commit_after>const isBrowser = !require('is-plask')
const log = require('debug')('profiler')
let canvas = null
let ctx2d = null
const W = 250
const H = 800
const M = 10
const LINE_H = 16
const FONT_H = 11
const FONT = FONT_H + 'px Droid Sans Mono, Andale Mono, monospace'

function ms (time) {
  var f = Math.floor(time * 10) / 10
  var s = '' + f
  if (f % 1 === 0) s += '.0'
  if (f < 10) s = ' ' + s
  return s + ''
}

function pa3 (f) {
  if (f < 10) return '  ' + f
  if (f < 100) return ' ' + f
  return f
}

function createProfiler (ctx) {
  const gl = ctx.gl
  if (isBrowser && !canvas) {
    canvas = document.createElement('canvas')
    canvas.id = 'pex-renderer-profiler'
    canvas.width = W * 2
    canvas.height = H * 2
    document.body.appendChild(canvas)
    canvas.style.position = 'fixed'
    canvas.style.width = W + 'px'
    canvas.style.height = H + 'px'
    canvas.style.top = M + 'px'
    canvas.style.right = M + 'px'
    canvas.style.zIndex = 1000
    ctx2d = canvas.getContext('2d')
  }

  const profiler = {
    canvas: canvas,
    frame: 0,
{'fraction_non_alphanumeric': 0.1476257639868359, 'fraction_numerical': 0.034790785143394454, 'mean_word_length': 2.7008695652173915, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1486112', 'n_tokens_mistral': 853, 'n_tokens_neox': 787, 'n_words': 239}