61 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
			
		
		
	
	
			61 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
const { mlog } = require("./IPC");
 | 
						|
 | 
						|
exports.ws_writed_bytes = 0;
 | 
						|
exports.ws_readed_bytes = 0;
 | 
						|
exports.ws_total_bytes = 0;
 | 
						|
exports.ws_sended_packs = 0;
 | 
						|
exports.ws_recaived_packs = 0;
 | 
						|
exports.ws_total_packs = 0;
 | 
						|
exports.mwse_rooms = 0;
 | 
						|
exports.mwse_clients = 0;
 | 
						|
 | 
						|
 | 
						|
process.send({
 | 
						|
    core: "writestat",
 | 
						|
    ws_writed_bytes: exports.ws_writed_bytes,
 | 
						|
    ws_readed_bytes: exports.ws_readed_bytes,
 | 
						|
    ws_total_bytes: exports.ws_total_bytes,
 | 
						|
    ws_sended_packs: exports.ws_sended_packs,
 | 
						|
    ws_recaived_packs: exports.ws_recaived_packs,
 | 
						|
    ws_total_packs: exports.ws_total_packs,
 | 
						|
    mwse_rooms: exports.mwse_rooms,
 | 
						|
    mwse_clients: exports.mwse_clients
 | 
						|
});
 | 
						|
setInterval(()=>{
 | 
						|
    process.send({
 | 
						|
        core: "writestat",
 | 
						|
        ws_writed_bytes: exports.ws_writed_bytes,
 | 
						|
        ws_readed_bytes: exports.ws_readed_bytes,
 | 
						|
        ws_total_bytes: exports.ws_total_bytes,
 | 
						|
        ws_sended_packs: exports.ws_sended_packs,
 | 
						|
        ws_recaived_packs: exports.ws_recaived_packs,
 | 
						|
        ws_total_packs: exports.ws_total_packs,
 | 
						|
        mwse_rooms: exports.mwse_rooms,
 | 
						|
        mwse_clients: exports.mwse_clients
 | 
						|
    })
 | 
						|
    mlog(`writed ${exports.ws_writed_bytes} bytes, readed ${exports.ws_readed_bytes} bytes`);
 | 
						|
    exports.ws_writed_bytes = 0;
 | 
						|
    exports.ws_readed_bytes = 0;
 | 
						|
    exports.ws_total_bytes = 0;
 | 
						|
    exports.ws_sended_packs = 0;
 | 
						|
    exports.ws_recaived_packs = 0;
 | 
						|
    exports.ws_total_packs = 0;
 | 
						|
    process.send({
 | 
						|
        core: "readstat",
 | 
						|
        ws_writed_bytes: exports.ws_writed_bytes,
 | 
						|
        ws_readed_bytes: exports.ws_readed_bytes,
 | 
						|
        ws_total_bytes: exports.ws_total_bytes,
 | 
						|
        ws_sended_packs: exports.ws_sended_packs,
 | 
						|
        ws_recaived_packs: exports.ws_recaived_packs,
 | 
						|
        ws_total_packs: exports.ws_total_packs,
 | 
						|
        mwse_rooms: exports.mwse_rooms,
 | 
						|
        mwse_clients: exports.mwse_clients
 | 
						|
    })
 | 
						|
}, 3000)
 | 
						|
 | 
						|
process.on('message', stat => {
 | 
						|
    if(stat.type == ':stats:')
 | 
						|
    {
 | 
						|
        exports.others = stat.data;
 | 
						|
    }
 | 
						|
}) |