예제 #1
0
파일: llua.c 프로젝트: dilawar/suckless
void print_lua_gauge(struct text_object *obj, char *p, int p_max_size)
{
	double per;

	if (!p_max_size)
		return;

	if (llua_getnumber(obj->data.s, &per)) {
		new_gauge(obj, p, p_max_size, (per/100.0 * 255));
	}
}
예제 #2
0
파일: exec.c 프로젝트: bsdplus/fluxbsd
void print_execgauge(struct text_object *obj, char *p, int p_max_size)
{
	double barnum;

	read_exec(obj->data.s, p, p_max_size, 1);
	barnum = get_barnum(p); /*using the same function*/

	if (barnum >= 0.0) {
		barnum /= 100;
		new_gauge(obj, p, p_max_size, round_to_int(barnum * 255.0));
	}
}
예제 #3
0
파일: exec.c 프로젝트: bsdplus/fluxbsd
void print_execigauge(struct text_object *obj, char *p, int p_max_size)
{
	struct execi_data *ed = obj->data.opaque;

	if (!ed)
		return;

	if (time_to_update(ed)) {
		double barnum;

		read_exec(ed->cmd, p, p_max_size, 1);
		barnum = get_barnum(p);

		if (barnum >= 0.0) {
			ed->barnum = 255 * barnum / 100.0;
		}
		ed->last_update = current_update_time;
	}
	new_gauge(obj, p, p_max_size, round_to_int(ed->barnum));
}
void MetricsRecordBuilder::addGauge(const BasicItemReadOnly& info, double val) {
    MetricSnapshotPtr new_gauge(new MetricGaugeDouble(info, val));
    add(new_gauge);
}