<commit_before>(function (app) {

    function $(elt) { return document.createElement(elt); }

    function SpeedOMeter (config) {
        this.maxVal = config.maxVal;
        this.unit = config.unit ? config.unit + " " : "";
        this.name = config.name;
        this.container = config.container;
        this.elt = $("div");
        this.elt.className = "monitor";

        var title = $("span");
        title.innerText = this.name;
        title.className = 'title';
        this.elt.appendChild(title);

        this.screenCurrent = $("span");
        this.screenCurrent.className = 'screen current';
        this.screenCurrent.innerText = "current";
        this.elt.appendChild(this.screenCurrent);

        this.screenMax = $("span");
        this.screenMax.className = 'screen max';
        this.screenMax.innerText = this.maxVal + this.unit;
        this.elt.appendChild(this.screenMax);

        this.needle = $("div");
        this.needle.className = "needle";
        this.elt.appendChild(this.needle);

        this.light = $("div");
        this.light.className = "green light";
        this.elt.appendChild(this.light);

        var wheel = $("div");
        wheel.className = "wheel";
        this.elt.appendChild(wheel);

        this.container.appendChild(this.elt);
    }

    SpeedOMeter.prototype.red = function () {
        this.light.className = "red light";
    };

    SpeedOMeter.prototype.green = function () {
        this.light.className = "red green";
    };

    SpeedOMeter.prototype.update = function (val) {
        if (val > this.maxVal) {
            this.maxVal = val;
            this.screenMax.innerText = val + this.unit;
        }
        Zanimo.transition(
            this.needle,
            "transform",
            "rotate(" + (val * 170 / this.maxVal) + "deg)",
            500,
            "ease-in"
        );
        this.screenCurrent.innerText = val + this.unit;
    }

    function init() {

        document.addEventListener('touchmove', function (evt) {
            evt.preventDefault();
        }, false);

        app.rps = new SpeedOMeter({
            name : "RPS",
            maxVal : 40000,
            container : document.body
        });

        app.memory = new SpeedOMeter({
            name : "MEMORY",
            maxVal : app.totalMemory,
            unit : "MB",
            container : document.body
        });

        app.cpu = new SpeedOMeter({
            name : "CPU",
            maxVal : 100,
            unit : "%",
            container : document.body
        });

        var button = $("button");
        button.className = "gc";
        button.innerText = "GARBAGE RESET";

        button.addEventListener("click", function (evt){
            evt.target.className += " touch";
            var xhr = new XMLHttpRequest();
            xhr.open("POST", "/gc!", true);
            xhr.onreadystatechange = function (){
                if(xhr.readyState == 4) {
                    evt.target.className = "gc";<commit_msg>[RPS sample] fixing speedometer max value<commit_after>(function (app) {

    function $(elt) { return document.createElement(elt); }

    function SpeedOMeter (config) {
        this.maxVal = config.maxVal;
        this.unit = config.unit ? config.unit + " " : "";
        this.name = config.name;
        this.container = config.container;
        this.elt = $("div");
        this.elt.className = "monitor";

        var title = $("span");
        title.innerHTML = this.name;
        title.className = 'title';
        this.elt.appendChild(title);

        this.screenCurrent = $("span");
        this.screenCurrent.className = 'screen current';
        this.screenCurrent.innerHTML = "current";
        this.elt.appendChild(this.screenCurrent);

        this.screenMax = $("span");
        this.screenMax.className = 'screen max';
        this.screenMax.innerHTML = this.maxVal + this.unit;
        this.elt.appendChild(this.screenMax);

        this.needle = $("div");
        this.needle.className = "needle";
        this.elt.appendChild(this.needle);

        this.light = $("div");
        this.light.className = "green light";
        this.elt.appendChild(this.light);

        var wheel = $("div");
        wheel.className = "wheel";
        this.elt.appendChild(wheel);

        this.container.appendChild(this.elt);
    }

    SpeedOMeter.prototype.red = function () {
        this.light.className = "red light";
    };

    SpeedOMeter.prototype.green = function () {
        this.light.className = "red green";
    };

    SpeedOMeter.prototype.update = function (val) {
        Zanimo.transition(
            this.needle,
            "transform",
            "rotate(" + (val > this.maxVal ? 175 : val * 170 / this.maxVal) + "deg)",
            500,
            "ease-in"
        );
        this.screenCurrent.innerHTML = val + this.unit;
    }

    function init() {

        document.addEventListener('touchmove', function (evt) {
            evt.preventDefault();
        }, false);

        app.rps = new SpeedOMeter({
            name : "RPS",
            maxVal : 40000,
            container : document.body
        });

        app.memory = new SpeedOMeter({
            name : "MEMORY",
            maxVal : app.totalMemory,
            unit : "MB",
            container : document.body
        });

        app.cpu = new SpeedOMeter({
            name : "CPU",
            maxVal : 100,
            unit : "%",
            container : document.body
        });

        var button = $("button");
        button.className = "gc";
        button.innerHTML = "GARBAGE RESET";

        button.addEventListener("click", function (evt){
            evt.target.className += " touch";
            var xhr = new XMLHttpRequest();
            xhr.open("POST", "/gc!", true);
            xhr.onreadystatechange = function (){
                if(xhr.readyState == 4) {
                    evt.target.className = "gc";
{'fraction_non_alphanumeric': 0.13884214069336923, 'fraction_numerical': 0.00555368562773477, 'mean_word_length': 1.7693383038210624, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3222314', 'n_tokens_mistral': 1701, 'n_tokens_neox': 1640, 'n_words': 323}