<commit_before>//#######################################

var ENUMS = require('./enums');
var logger = require('./logger');
var sqlite = require('./sql/default');

var path = require('path');
var exec = require('child_process').exec;
var HashMap = require('hashmap').HashMap;

var Jpeg = require('jpeg').Jpeg;
var Png = require('png').Png;
var BinaryServer = require('binaryjs').BinaryServer;
var bs = BinaryServer({port : 9000, chunkSize : 512});

//#######################################

var CudaRender = require('./render').CudaRender;
var cu = require('./load');
var cuCtx = new cu.Ctx(0, cu.Device(0));

//#######################################

var volumeMap = new HashMap();
var useMap = new HashMap();
var maintainInfoMap = new HashMap();

bs.on('connection', function(client){

    client.on('stream', function(stream, meta){

        logger.debug('Byte stream connection attempt ' + client.id);

        var cudaInterval = function () {

            var maintainInfo = maintainInfoMap.get(client.id);
            if(maintainInfo == undefined || maintainInfo == null){
                return;
            }

            var status = maintainInfo.status;
            if(status == undefined || status == null){
                return;
            }

            var cudaRender = maintainInfo.cudaRender;
            if(cudaRender == undefined || cudaRender == null){
                return;
            }

            if(status.streamType == ENUMS.STREAM_TYPE.START){

                var hrstart = process.hrtime();

                cudaRender.start();

                var png = new Png(cudaRender.d_outputBuffer, 512, 512, 'rgba');
                png.encode(function (png_img) {
                    try {
                        if (client._socket._socket == undefined) {
                            logger.error('Connection already refused async png :: client id', client.id);
                        } else {
                            client.send(png_img);
                        }
                    } catch (error) {
                        logger.error('Connection refused async png ', error);
                        closeCallback(client.id);
                        return;
                    }
                });
                cudaRender.end();

                hrend = process.hrtime(hrstart);
                logger.debug('Make frame execution time (hr) : %ds %dms', hrend[0], hrend[1]/1000000);
            } else if(status.streamType == ENUMS.STREAM_TYPE.FINISH){

                var hrstart = process.hrtime();

                cudaRender.start();
                
                var png = new Png(cudaRender.d_outputBuffer, 512, 512, 'rgba');
                png.encode(function (png_img) {
                    try {
                        if (client._socket._socket == undefined) {
                            logger.error('Connection already refused async png :: client id', client.id);
                        } else {
                            client.send(png_img);
                        }
                    } catch (error) {
                        logger.error('Connection refused async png ', error);
                        closeCallback(client.id);
                        return;
                    }
                });
                
                cudaRender.end();

                hrend = process.hrtime(hrstart);
                logger.debug('Make frame adaptive time (hr) : %ds %dms', hrend[0], hrend[1]/1000000);

            } else if(status.streamType == ENUMS.STREAM_TYPE.EVENT){

                var hrstart = process.hrtime();
                cudaRender.start();
                var jpeg = new Jpeg(cudaRender.d_outputBuffer, 512, 512, 'rgba');
                try {

                    if (client._socket._socket == undefined) {
                        logger.error('Connection already refused sync jpeg :: client id', client.id);
                    } else {
                        client.send(jpeg.encodeSync());
                    }

                }catch (error){
                    logger.error('Connection refused sync jpeg', error);
                    closeCallback(client.id);
                    return;
                }
                cudaRender.end();
                hrend = process.hrtime(hrstart);

                logger.debug('Make frame and jpeg compress execution time (hr) : %ds %dms', hrend[0], hrend[1]/1000000);
            }else{
                logger.error('Request type not defined cuda' + status.streamType);
            }
        };

        /**
         * Client에서 요청받은 Byte Data를 버퍼로 변경해주는 함수
         */
        var returnParameter = function(buffer){
            var parameter = {<commit_msg>주석 제거<commit_after>//#######################################

var ENUMS = require('./enums');
var logger = require('./logger');
var sqlite = require('./sql/default');

var path = require('path');
var exec = require('child_process').exec;
var HashMap = require('hashmap').HashMap;

var Jpeg = require('jpeg').Jpeg;
var Png = require('png').Png;
var BinaryServer = require('binaryjs').BinaryServer;
var bs = BinaryServer({port : 9000, chunkSize : 512});

//#######################################

var CudaRender = require('./render').CudaRender;
var cu = require('./load');
var cuCtx = new cu.Ctx(0, cu.Device(0));

//#######################################

var volumeMap = new HashMap();
var useMap = new HashMap();
var maintainInfoMap = new HashMap();

bs.on('connection', function(client){

    client.on('stream', function(stream, meta){

        logger.debug('Byte stream connection attempt ' + client.id);

        var cudaInterval = function () {

            var maintainInfo = maintainInfoMap.get(client.id);
            if(maintainInfo == undefined || maintainInfo == null){
                return;
            }

            var status = maintainInfo.status;
            if(status == undefined || status == null){
                return;
            }

            var cudaRender = maintainInfo.cudaRender;
            if(cudaRender == undefined || cudaRender == null){
                return;
            }

            if(status.streamType == ENUMS.STREAM_TYPE.START){

                var hrstart = process.hrtime();

                cudaRender.start();

                var png = new Png(cudaRender.d_outputBuffer, 512, 512, 'rgba');
                png.encode(function (png_img) {
                    try {
                        if (client._socket._socket == undefined) {
                            logger.error('Connection already refused async png :: client id', client.id);
                        } else {
                            client.send(png_img);
                        }
                    } catch (error) {
                        logger.error('Connection refused async png ', error);
                        closeCallback(client.id);
                        return;
                    }
                });
                cudaRender.end();

                hrend = process.hrtime(hrstart);
                logger.debug('Make frame execution time (hr) : %ds %dms', hrend[0], hrend[1]/1000000);
            } else if(status.streamType == ENUMS.STREAM_TYPE.FINISH){

                var hrstart = process.hrtime();

                cudaRender.start();
                
                var png = new Png(cudaRender.d_outputBuffer, 512, 512, 'rgba');
                png.encode(function (png_img) {
                    try {
                        if (client._socket._socket == undefined) {
                            logger.error('Connection already refused async png :: client id', client.id);
                        } else {
                            client.send(png_img);
                        }
                    } catch (error) {
                        logger.error('Connection refused async png ', error);
                        closeCallback(client.id);
                        return;
                    }
                });
                
                cudaRender.end();

                hrend = process.hrtime(hrstart);
                logger.debug('Make frame adaptive time (hr) : %ds %dms', hrend[0], hrend[1]/1000000);

            } else if(status.streamType == ENUMS.STREAM_TYPE.EVENT){

                var hrstart = process.hrtime();
                cudaRender.start();
                var jpeg = new Jpeg(cudaRender.d_outputBuffer, 512, 512, 'rgba');
                try {

                    if (client._socket._socket == undefined) {
                        logger.error('Connection already refused sync jpeg :: client id', client.id);
                    } else {
                        client.send(jpeg.encodeSync());
                    }

                }catch (error){
                    logger.error('Connection refused sync jpeg', error);
                    closeCallback(client.id);
                    return;
                }
                cudaRender.end();
                hrend = process.hrtime(hrstart);

                logger.debug('Make frame and jpeg compress execution time (hr) : %ds %dms', hrend[0], hrend[1]/1000000);
            }else{
                logger.error('Request type not defined cuda' + status.streamType);
            }
        };
        
        var returnParameter = function(buffer){
            var parameter = {
{'fraction_non_alphanumeric': 0.13794580700439113, 'fraction_numerical': 0.0115668844382564, 'mean_word_length': 1.4599578503688093, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6584407', 'n_tokens_mistral': 2483, 'n_tokens_neox': 2254, 'n_words': 526}