<commit_before>// This produces 256kB of random buffer data in 16 16kB chunks
// The upload process takes advantage of the prework in assembing the upload payload data
var uploadBuffers = [];
var getRandom = function (min, max) {
    return Math.floor(Math.random() * (max - min + 1) + min)
};

(function primeBuffers() {
    var oneKbBuffers = [];
    var text = [];
    var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    var len = possible.length;
    for (var j = 0; j < 16; j++) {
        text = []; //reset
        for (var i = 0; i < 1024; i++) {
            text.push(possible.charAt(Math.floor(Math.random() * len)));
        }
        oneKbBuffers.push(text.join(''));
    }
    // now assemble the larger buffers
    var tmpBuff = [];
    for (var k = 0; k < 16; k++) {
        //console.log(getRandom(0, 15));
        tmpBuff = []; //reset
        for (var i = 0; i < 16; i++) {
            tmpBuff.push(oneKbBuffers[getRandom(0, 15)]);
        }
        uploadBuffers.push(tmpBuff.join(''));
    }
    console.log(uploadBuffers);
})();


function UploadResponseSampler() {
    return {
        run: function (sampleIteration, callback) {
            var postData = this.genData(sampleIteration); //build the post data outside of the timer
            var start = new Date;
            var customContext = {
                cb: callback,
                startTime: start,
                sampleIteration: sampleIteration
            };
            var request = $.ajax({
                url: "/upload",
                type: "POST",
                data: {
                    id: postData
                },<commit_msg>removed console logging<commit_after>// This produces 256kB of random buffer data in 16 16kB chunks
// The upload process takes advantage of the prework in assembing the upload payload data
var uploadBuffers = [];
var getRandom = function (min, max) {
    return Math.floor(Math.random() * (max - min + 1) + min)
};

(function primeBuffers() {
    var oneKbBuffers = [];
    var text = [];
    var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    var len = possible.length;
    for (var j = 0; j < 16; j++) {
        text = []; //reset
        for (var i = 0; i < 1024; i++) {
            text.push(possible.charAt(Math.floor(Math.random() * len)));
        }
        oneKbBuffers.push(text.join(''));
    }
    // now assemble the larger buffers
    var tmpBuff = [];
    for (var k = 0; k < 16; k++) {
        //console.log(getRandom(0, 15));
        tmpBuff = []; //reset
        for (var i = 0; i < 16; i++) {
            tmpBuff.push(oneKbBuffers[getRandom(0, 15)]);
        }
        uploadBuffers.push(tmpBuff.join(''));
    }
})();


function UploadResponseSampler() {
    return {
        run: function (sampleIteration, callback) {
            var postData = this.genData(sampleIteration); //build the post data outside of the timer
            var start = new Date;
            var customContext = {
                cb: callback,
                startTime: start,
                sampleIteration: sampleIteration
            };
            var request = $.ajax({
                url: "/upload",
                type: "POST",
                data: {
                    id: postData
                },
{'fraction_non_alphanumeric': 0.12696493349455865, 'fraction_numerical': 0.022974607013301087, 'mean_word_length': 1.8899563318777293, 'pattern_counts': {'":': 0, '<': 11, '<?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': '346020', 'n_tokens_mistral': 1061, 'n_tokens_neox': 965, 'n_words': 279}