+ END OBJ(top_time, INFO_TOP)
+ char buf[64];
+ int n;
+
+ if (!arg) {
+ ERR("top_time needs arguments");
+ obj->type = OBJ_text;
+ obj->data.s = strndup("${top_time}", text_buffer_size);
+ return NULL;
+ }
+ if (sscanf(arg, "%63s %i", buf, &n) == 2) {
+ if (strcmp(buf, "name") == EQUAL) {
+ obj->data.top.type = TOP_NAME;
+ } else if (strcmp(buf, "cpu") == EQUAL) {
+ obj->data.top.type = TOP_CPU;
+ } else if (strcmp(buf, "pid") == EQUAL) {
+ obj->data.top.type = TOP_PID;
+ } else if (strcmp(buf, "mem") == EQUAL) {
+ obj->data.top.type = TOP_MEM;
+ } else if (strcmp(buf, "time") == EQUAL) {
+ obj->data.top.type = TOP_TIME;
+ } else if (strcmp(buf, "mem_res") == EQUAL) {
+ obj->data.top.type = TOP_MEM_RES;
+ } else if (strcmp(buf, "mem_vsize") == EQUAL) {
+ obj->data.top.type = TOP_MEM_VSIZE;
+ } else {
+ ERR("invalid arg for top");
+ return NULL;
+ }
+ if (n < 1 || n > 10) {
+ CRIT_ERR("invalid arg for top");
+ return NULL;
+ } else {
+ obj->data.top.num = n - 1;
+ top_time = 1;
+ }
+ } else {
+ ERR("invalid args given for top");
+ return NULL;
+ }