<commit_before><script language="javascript" type="text/javascript" src="flot/jquery.js"></script>
<script language="javascript" type="text/javascript" src="flot/jquery.flot.js"></script>

<script>
  let output_usage, output_next, output_unthrottler, div_usage, div_next;
  let data;
  let max = 0;
  let unthrottlers = ['none', 'gUM', 'rtc', 'iDB', 'ws', 'webaudio', 'audio', 'video'];
  let offset;
  let next_ctr_handle = 0;
  var next = 0;

  let series = {
    points: {
      show: true
    },
    lines: {
      show: true,
    }
  }

  function collectData(work, delay, actual) {
    let value = (work / actual) * 100;
    max = Math.max(max, value);

    data.push([performance.now() - offset, value])
    output_usage.innerText = (value).toFixed(1);
  }

  function start(n, time) {
    max = 0;
    clearInterval(next_ctr_handle);
    div_next.style.display = 'none';
    div_usage.style.display = 'inline';
    data = [];
    output_next.innerText = 0;
    output_usage.innerText = 0;
    output_unthrottler.innerText = unthrottlers[n];
    opener.setCallback(collectData);
    offset = performance.now();

    opener.start();
    setTimeout(() => opener.addUnthrottler(unthrottlers[n]), time / 2);
    setTimeout(() => stop(n), time);
  }

  function countDown(n) {
    next = n;
    next_ctr_handle = setInterval(function() {
      if (next) {
        output_next.innerText = --next;
      }
    }, 1000);
  }

  function stop(n) {
    opener.stop();
    opener.clearUnthrottler();
    div_next.style.display = 'inline';
    div_usage.style.display = 'none';
    output_usage.innerText = 0;
    output_unthrottler.innerText = "";
    series.label = "Unthrottler: " + unthrottlers[n];

    $.plot($("#plot" + n), [ data ], { yaxis: { max: max * 1.2 }, series: series });

    if (++n < unthrottlers.length) {
      countDown(next);
      setTimeout(() => start(n, 30000), next * 1000);
    } else {
      div_next.style.display = 'none';
      div_usage.style.display = 'none';
      document.getElementById('div_done').style.display = 'inline';
    }
  }

  function init() {
    output_usage = document.getElementById('output_usage');
    output_next = document.getElementById('output_next');
    output_unthrottler = document.getElementById('output_unthrottler');
    div_usage = document.getElementById('div_usage');
    div_next = document.getElementById('div_next');

    output_next.innerText = 10;
    countDown(10);
    setTimeout(() => start(0, 60000), 10000);
  }

  function uninit() {
    opener.stop();
  }
  addEventListener('load', init);
  addEventListener('unload', uninit);
</script>
<div id="div_usage" style="display:none">
  Current throttling level: <span id="output_usage"></span>%<br/>
  Current unthrottler: <span id="output_unthrottler"></span>
</div>
<div id="div_next">Starting next test in: <span id="output_next"></span> seconds</div>
<div id="div_done" style="display:none">Done</div>

<div id="plot0" style="width:600px;height:300px"></div><br/>
<div id="plot1" style="width:600px;height:300px"></div><br/>
<div id="plot2" style="width:600px;height:300px"></div><br/>
<div id="plot3" style="width:600px;height:300px"></div><br/>
<div id="plot4" style="width:600px;height:300px"></div><br/>
<div id="plot5" style="width:600px;height:300px"></div><br/>
<div id="plot6" style="width:600px;height:300px"></div><br/>
<div id="plot7" style="width:600px;height:300px"></div><br/>
<commit_msg>Check opener<commit_after><script language="javascript" type="text/javascript" src="flot/jquery.js"></script>
<script language="javascript" type="text/javascript" src="flot/jquery.flot.js"></script>

<script>
  let output_usage, output_next, output_unthrottler, div_usage, div_next;
  let data;
  let max = 0;
  let unthrottlers = ['none', 'gUM', 'rtc', 'iDB', 'ws', 'webaudio', 'audio', 'video'];
  let offset;
  let next_ctr_handle = 0;
  var next = 0;

  let series = {
    points: {
      show: true
    },
    lines: {
      show: true,
    }
  }

  function collectData(work, delay, actual) {
    let value = (work / actual) * 100;
    max = Math.max(max, value);

    data.push([performance.now() - offset, value])
    output_usage.innerText = (value).toFixed(1);
  }

  function start(n, time) {
    max = 0;
    clearInterval(next_ctr_handle);
    div_next.style.display = 'none';
    div_usage.style.display = 'inline';
    data = [];
    output_next.innerText = 0;
    output_usage.innerText = 0;
    output_unthrottler.innerText = unthrottlers[n];

    if (!opener) {
      document.location = "index.html";
      return;
    }

    opener.setCallback(collectData);
    offset = performance.now();

    opener.start();
    setTimeout(() => opener.addUnthrottler(unthrottlers[n]), time / 2);
    setTimeout(() => stop(n), time);
  }

  function countDown(n) {
    next = n;
    clearInterval(next_ctr_handle);
    next_ctr_handle = setInterval(function() {
      if (next) {
        output_next.innerText = --next;
      }
    }, 1000);
  }

  function stop(n) {
    if (!opener) {
      document.location = "index.html";
      return;
    }

    opener.stop();
    opener.clearUnthrottler();
    div_next.style.display = 'inline';
    div_usage.style.display = 'none';
    output_usage.innerText = 0;
    output_unthrottler.innerText = "";
    series.label = "Unthrottler: " + unthrottlers[n];

    $.plot($("#plot" + n), [ data ], { yaxis: { max: max * 1.2 }, series: series });

    if (++n < unthrottlers.length) {
      countDown(30);
      setTimeout(() => start(n, 30000), 30 * 1000);
    } else {
      div_next.style.display = 'none';
      div_usage.style.display = 'none';
      document.getElementById('div_done').style.display = 'inline';
    }
  }

  function init() {
    if (!opener) {
      document.location = "index.html";
      return;
    }

    output_usage = document.getElementById('output_usage');
    output_next = document.getElementById('output_next');
    output_unthrottler = document.getElementById('output_unthrottler');
    div_usage = document.getElementById('div_usage');
    div_next = document.getElementById('div_next');

    output_next.innerText = 5;
    countDown(5);
    setTimeout(() => start(0, 60000), 5000);
  }

  function uninit() {
    if (opener) {
      opener.stop();
    }
  }

  addEventListener('load', init);
  addEventListener('unload', uninit);
</script>
<div id="div_usage" style="display:none">
  Current throttling level: <span id="output_usage"></span>%<br/>
  Current unthrottler: <span id="output_unthrottler"></span>
</div>
<div id="div_next">Starting next test in: <span id="output_next"></span> seconds</div>
<div id="div_done" style="display:none">Done</div>

<div id="plot0" style="width:600px;height:300px"></div><br/>
<div id="plot1" style="width:600px;height:300px"></div><br/>
<div id="plot2" style="width:600px;height:300px"></div><br/>
<div id="plot3" style="width:600px;height:300px"></div><br/>
<div id="plot4" style="width:600px;height:300px"></div><br/>
<div id="plot5" style="width:600px;height:300px"></div><br/>
<div id="plot6" style="width:600px;height:300px"></div><br/>
<div id="plot7" style="width:600px;height:300px"></div><br/>

{'fraction_non_alphanumeric': 0.17924001117630622, 'fraction_numerical': 0.02752165409332216, 'mean_word_length': 3.850271002710027, 'pattern_counts': {'":': 0, '<': 91, '<?xml version=': 0, '>': 97, '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': '2042849', 'n_tokens_mistral': 2614, 'n_tokens_neox': 2450, 'n_words': 451}