<commit_before>var intervalTime = 3000; //监控频率
var is_start = true; //已经开始监控

function monitor_task() {
	if (is_start) {
		get_server_data();
    }
	else {
		setTimeout(monitor_task, intervalTime);
	}
}

function sec_2_hour(sec) {
	var h = parseInt(sec / 3600);
	var m = parseInt((sec - h * 3600) / 60)
	var s = sec - h * 3600 - m * 60;
	return h + ':' + m + ':' + s;
}

function fill_data_table(data) {
	var keys = ['status_code', 'http_length', 'encoding', 'connection', 'server']
	var key = null;
	for (var i in keys) {
		key = keys[i];
		$('#' + key).text(data[key]);
	}
	
	//遍历key中以db开头的，标示不同的数据库
	var html = "";
	for (var key in data) {
		if (key.substring(0, 2) == 'db') {
			html = html + '<tr class="rb_td"><td colspan="2">'+key+'</td><td colspan="2">'+data[key].keys+'</td><td colspan="2">'+data[key].expires+'</td><td colspan="2">'+data[key].avg_ttl+'</td></tr>';
		}
	}
	//删除已有的，append新增的
	$('tr.rb_td').remove();
	$('#data_table tbody').append(html);
}

function do_server_status(data) {
	var x_date = (new Date()).toLocaleTimeString().replace(/^\D*/,'');
	if (data.success == 1) {
		fill_data_table(data.data);
		//update charts
		timechart.addData([
		   [
              0,        // 系列索引
              data.data.get_time,
              false,
              false,
              x_date<commit_msg>http monitor time * 1000<commit_after>var intervalTime = 3000; //监控频率
var is_start = true; //已经开始监控

function monitor_task() {
	if (is_start) {
		get_server_data();
    }
	else {
		setTimeout(monitor_task, intervalTime);
	}
}

function sec_2_hour(sec) {
	var h = parseInt(sec / 3600);
	var m = parseInt((sec - h * 3600) / 60)
	var s = sec - h * 3600 - m * 60;
	return h + ':' + m + ':' + s;
}

function fill_data_table(data) {
	var keys = ['status_code', 'http_length', 'encoding', 'connection', 'server']
	var key = null;
	for (var i in keys) {
		key = keys[i];
		$('#' + key).text(data[key]);
	}
	
	//遍历key中以db开头的，标示不同的数据库
	var html = "";
	for (var key in data) {
		if (key.substring(0, 2) == 'db') {
			html = html + '<tr class="rb_td"><td colspan="2">'+key+'</td><td colspan="2">'+data[key].keys+'</td><td colspan="2">'+data[key].expires+'</td><td colspan="2">'+data[key].avg_ttl+'</td></tr>';
		}
	}
	//删除已有的，append新增的
	$('tr.rb_td').remove();
	$('#data_table tbody').append(html);
}

function do_server_status(data) {
	var x_date = (new Date()).toLocaleTimeString().replace(/^\D*/,'');
	if (data.success == 1) {
		fill_data_table(data.data);
		//update charts
		timechart.addData([
		   [
              0,        // 系列索引
              data.data.get_time * 1000,
              false,
              false,
              x_date
{'fraction_non_alphanumeric': 0.2043906131718395, 'fraction_numerical': 0.02498107494322483, 'mean_word_length': 3.0228310502283104, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '7536512', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1082, 'n_words': 207}