void iodriver_printstats() { int i; int j; struct ioq **queueset; int setsize = 0; char prefix[80]; fprintf (outputfile, "\nOVERALL I/O SYSTEM STATISTICS\n"); fprintf (outputfile, "-----------------------------\n\n"); sprintf (prefix, "Overall I/O System "); ioqueue_printstats (&OVERALLQUEUE, 1, prefix); fprintf (outputfile, "\nSYSTEM-LEVEL LOGORG STATISTICS\n"); fprintf (outputfile, "------------------------------\n\n"); sprintf(prefix, "System "); logorg_printstats(sysorgs, numsysorgs, prefix); fprintf (outputfile, "\nIODRIVER STATISTICS\n"); fprintf (outputfile, "-------------------\n\n"); for (i = 0; i < numiodrivers; i++) { setsize += iodrivers[i]->numdevices; } queueset = (struct ioq **)DISKSIM_malloc(setsize*sizeof(struct ioq *)); setsize = 0; for (i = 0; i < numiodrivers; i++) { for (j = 0; j < iodrivers[i]->numdevices; j++) { queueset[setsize] = iodrivers[i]->devices[j].queue; setsize++; } } sprintf(prefix, "IOdriver "); if (stat_get_count(&emptyqueuestats) > 0) { stat_print(&emptyqueuestats, prefix); } if (stat_get_count(&initiatenextstats) > 0) { stat_print(&initiatenextstats, prefix); } ioqueue_printstats(queueset, setsize, prefix); if ((drv_printperdiskstats == TRUE) && ((numiodrivers > 1) || (iodrivers[0]->numdevices > 1))) { for (i = 0; i < numiodrivers; i++) { for (j = 0; j < iodrivers[i]->numdevices; j++) { fprintf (outputfile, "\nI/O Driver #%d - Device #%d\n", i, j); sprintf(prefix, "IOdriver #%d device #%d ", i, j); ioqueue_printstats(&iodrivers[i]->devices[j].queue, 1, prefix); } } } free(queueset); queueset = NULL; }
void SawaiWave::inner_printState(const pState s, int frame) const { switch (int(printmode)) { case 0: dyn_print(s, frame); break; case 1: stat_print(s, frame); break; default: stat_print(s, frame); } }
static void sr_print(int zflag) { int field_width; field_width = getstats_rpc(); if (field_width == 0) return; stat_print("\nServer rpc:\nConnection oriented:", rpc_cots_server_kstat, &old_rpc_cots_server_kstat.kst, field_width, zflag); stat_print("Connectionless:", rpc_clts_server_kstat, &old_rpc_clts_server_kstat.kst, field_width, zflag); stat_print("RDMA based:", rpc_rdma_server_kstat, &old_rpc_rdma_server_kstat.kst, field_width, zflag); }
static void print_stat(lru *l) { char bstat[1024]; stat_print(l, bstat, sizeof(bstat)); printf("-----------------------------------------\n"); printf("STAT\n%s", bstat); printf("-----------------------------------------\n"); }
static void cn_print(int zflag, int vflag) { int field_width; field_width = getstats_nfs(); if (field_width == 0) return; if (vflag == 0) { kstat_sum(nfs_client_kstat, nfs4_client_kstat, ksum_kstat); stat_print("\nClient nfs:", ksum_kstat, &old_ksum_kstat.kst, field_width, zflag); } if (vflag == 2 || vflag == 3) { stat_print("\nClient nfs:", nfs_client_kstat, &old_nfs_client_kstat.kst, field_width, zflag); } if (vflag == 4) { stat_print("\nClient nfs:", nfs4_client_kstat, &old_nfs4_client_kstat.kst, field_width, zflag); } if (vflag == 2 || vflag == 0) { field_width = getstats_rfsreq(2); req_print(rfsreqcnt_v2_kstat, &old_rfsreqcnt_v2_kstat.kst, 2, field_width, zflag); } if (vflag == 3 || vflag == 0) { field_width = getstats_rfsreq(3); req_print(rfsreqcnt_v3_kstat, &old_rfsreqcnt_v3_kstat.kst, 3, field_width, zflag); } if (vflag == 4 || vflag == 0) { field_width = getstats_rfsreq(4); req_print_v4(rfsreqcnt_v4_kstat, &old_rfsreqcnt_v4_kstat.kst, field_width, zflag); } }
void stoprun(int signo) { run = 0; gettimeofday(&stop, NULL); printf("Stopping...\n"); sleep(0.5); // because of no using locks it could happen, that there's is a half-written stat... :\ // try to avoid this by sleeping stat_print(); exit(0); }
static void sn_print(int zflag, int vflag) { int field_width; field_width = getstats_nfs(); if (field_width == 0) return; if (vflag == 2 || vflag == 0) { stat_print("\nServer NFSv2:", nfs_server_v2_kstat, &old_nfs_server_v2_kstat.kst, field_width, zflag); } if (vflag == 3 || vflag == 0) { stat_print("\nServer NFSv3:", nfs_server_v3_kstat, &old_nfs_server_v3_kstat.kst, field_width, zflag); } if (vflag == 4 || vflag == 0) { stat_print("\nServer NFSv4:", nfs_server_v4_kstat, &old_nfs_server_v4_kstat.kst, field_width, zflag); } if (vflag == 2 || vflag == 0) { field_width = getstats_rfsproc(2); req_print(rfsproccnt_v2_kstat, &old_rfsproccnt_v2_kstat.kst, 2, field_width, zflag); } if (vflag == 3 || vflag == 0) { field_width = getstats_rfsproc(3); req_print(rfsproccnt_v3_kstat, &old_rfsproccnt_v3_kstat.kst, 3, field_width, zflag); } if (vflag == 4 || vflag == 0) { field_width = getstats_rfsproc(4); req_print_v4(rfsproccnt_v4_kstat, &old_rfsproccnt_v4_kstat.kst, field_width, zflag); } }
void io_printstats() { int i; int cnt = 0; char prefix[80]; fprintf (outputfile, "\nSTORAGE SUBSYSTEM STATISTICS\n"); fprintf (outputfile, "----------------------------\n"); iotrace_printstats (outputfile); if ((tracestats) && (PRINTTRACESTATS)) { /* info relevant to HPL traces */ for (i=0; i<tracemappings; i++) { sprintf(prefix, "Mapped disk #%d ", i); stat_print(&tracestats[i], prefix); stat_print(&tracestats1[i], prefix); stat_print(&tracestats2[i], prefix); stat_print(&tracestats3[i], prefix); stat_print(&tracestats4[i], prefix); } } else if ((tracestats2) && (PRINTTRACESTATS)) { /* info to help with validation */ fprintf (outputfile, "\n"); stat_print(tracestats2, "VALIDATE "); stat_print(tracestats3, "VALIDATE "); stat_print(tracestats4, "VALIDATE "); stat_print(tracestats5, "VALIDATE "); for (i=0; i<10; i++) { cnt += validatebuf[i]; } fprintf (outputfile, "VALIDATE double disconnects: %5d \t%f\n", validatebuf[0], ((double) validatebuf[0] / (double) cnt)); fprintf (outputfile, "VALIDATE triple disconnects: %5d \t%f\n", validatebuf[1], ((double) validatebuf[1] / (double) cnt)); fprintf (outputfile, "VALIDATE read buffer hits: %5d \t%f\n", validatebuf[3], ((double) validatebuf[3] / (double) cnt)); fprintf (outputfile, "VALIDATE buffer misses: %5d \t%f\n", validatebuf[2], ((double) validatebuf[2] / (double) cnt)); } iodriver_printstats(); device_printstats(); controller_printstats(); bus_printstats(); }
void __exit kserver_exit(void) { int ci; ss_release(my_proto.proto.listener); for (ci = 0; ci < atomic_read(&conn_i); ++ci) if (conn[ci]) ss_close(conn[ci]); /* * FIXME at this point the module can crash if there is some active * softirq processing the sockets which are calling ssocket_hooks * callbacks. */ stat_print(); }
void io_stream_t::stat_print() const { stat.print(); proto.stat_print(name); }
void handle(char *fname, int fsfd, char *path) { xfs_fsop_handlereq_t handle; char buffer[1024]; char link[1024]; int ret; __u32 len; __u32 linklen; int fd; handle.path=path; handle.ohandle=buffer; handle.ohandlen=&len; ret=xfsctl(fname, fsfd, XFS_IOC_PATH_TO_FSHANDLE, &handle); if (ret) { perror("xfsctl(XFS_IOC_PATH_TO_FSHANDLE)"); exit(1); } printf("XFS_IOC_PATH_TO_FSHANDLE-\n handle: "); handle_print(handle.ohandle, *handle.ohandlen); printf("\n"); fd=open(path,O_RDONLY); if (fd<0) { perror("open"); exit(1); } handle.path=NULL; handle.fd=fd; handle.ohandle=buffer; handle.ohandlen=&len; ret=xfsctl(fname, fsfd, XFS_IOC_FD_TO_HANDLE, &handle); if (ret) { perror("ioctl(XFS_IOC_FD_TO_HANDLE)"); exit(1); } printf("XFS_IOC_FD_TO_HANDLE-\n path: %s\n handle: ", path); handle_print(handle.ohandle, *handle.ohandlen); printf("\n"); close(fd); handle.path=NULL; handle.fd=-1; handle.ihandle=buffer; handle.ihandlen=len; handle.ohandle=NULL; handle.ohandlen=NULL; ret=xfsctl(fname, fsfd, XFS_IOC_OPEN_BY_HANDLE, &handle); if (ret<0) { perror("xfsctl(XFS_IOC_OPEN_BY_HANDLE)"); exit(1); } printf("XFS_IOC_OPEN_BY_HANDLE-\n handle: "); handle_print(handle.ihandle, handle.ihandlen); printf("\n fd: %d\n stat- ", ret); stat_print(ret); close(ret); handle.path=path; handle.ohandle=buffer; handle.ohandlen=&len; ret=xfsctl(fname, fsfd, XFS_IOC_PATH_TO_HANDLE, &handle); if (ret) { perror("xfsctl(XFS_IOC_PATH_TO_HANDLE)"); exit(1); } printf("XFS_IOC_PATH_TO_HANDLE-\n path: %s\n handle: ", path); handle_print(handle.ohandle, *handle.ohandlen); printf("\n"); handle.path=NULL; handle.fd=-1; handle.ihandle=buffer; handle.ihandlen=len; handle.ohandle=link; linklen=sizeof(link); handle.ohandlen=&linklen; ret=xfsctl(fname, fsfd, XFS_IOC_READLINK_BY_HANDLE, &handle); if (ret<0) { perror("xfsctl(XFS_IOC_READLINK_BY_HANDLE)"); fprintf(stderr,"ERROR IGNORED\n"); } else { printf("XFS_IOC_READLINK_BY_HANDLE-\n handle: "); handle_print(handle.ihandle, handle.ihandlen); printf("\n link=\"%*.*s\"\n", ret, ret, (char*)handle.ohandle); } }
int capt_capt(opt_t *opt) { int frame_size; unsigned int frame_num; unsigned char *frame_buf_yuv, *frame_buf_rgb, *jpeg_buf; struct timeval start; const int fps = opt->fps_opt; const int wait_flag = (opt->fps_opt < opt->fps_dev); const int w = opt->width, h = opt->height; int q = 75; /* jpeg compress quality */ int len; char mh[PIPE_HEADER_LEN]; /* EMON system Message Header */ unsigned int ts; /* timestamp in Message Header */ frame_size = mchip_hsize() * mchip_vsize() * 3; frame_buf_yuv = (unsigned char*)malloc(frame_size); frame_buf_rgb = (unsigned char*)malloc(frame_size); jpeg_buf = (unsigned char*)malloc(frame_size); /* allocate enougth memory for jpeg_buf */ if (frame_buf_yuv == NULL || frame_buf_rgb == NULL ||jpeg_buf == NULL){ e_printf("cannot malloc for frame_buf or jpeg_buf\n"); return -1; } stat_init(&STAT); ts = rand() * opt->freq; mchip_continuous_start(); gettimeofday(&start, NULL); STAT.start = start; /* copy struct timeval */ d2_printf("\njpegcapt: %ld.%06ld: wait_flag=%d", start.tv_sec, start.tv_usec, wait_flag); for (frame_num = 0; opt->max_frame == 0 || frame_num < opt->max_frame; frame_num++, ts += opt->freq){ struct timeval c, b, a; /* capture, before(encoding), after */ int d1, d2; if (debug_level > 0 && (frame_num % opt->stat_freq)== 0){ stat_print(&STAT, frame_num); } if (wait_proper_time(&start, fps, frame_num, 1) < 0){ STAT.skip_count++; continue; /* skip capture because it's too late */ } STAT.capt_count++; gettimeofday(&c, NULL); mchip_continuous_read(frame_buf_yuv, mchip_hsize()*mchip_vsize()*2); yuv_convert(frame_buf_yuv, frame_buf_rgb, mchip_hsize(), mchip_vsize()); gettimeofday(&b, NULL); len = jpeg_encode(frame_buf_rgb, jpeg_buf, w, h, q); gettimeofday(&a, NULL); d1 = timeval_diff_usec(&b, &c); d2 = timeval_diff_usec(&a, &b); timeval_add_usec(&STAT.capt_total, d1); timeval_add_usec(&STAT.jpgenc_total, d2); d3_printf("\n frame=%d, ts=%d, jpg_len=%d, q=%d" ", t1=%d, t2=%d", frame_num, ts, len, q, d1, d2); if (len > opt->dsize ){ q *= 0.75; continue; /* skip this picture */ }else if (len < opt->dsize * 0.9 && q < 90) { q++; } bzero(&mh, PIPE_HEADER_LEN); pipe_set_version(&mh, 1); pipe_set_marker(&mh, 1); pipe_set_length(&mh, len); pipe_set_timestamp(&mh, ts); if (pipe_blocked_write_block(STDOUT, &mh, jpeg_buf) ==PIPE_ERROR){ d1_printf("\npipe_blocked_write_block error!!" "len=%d, ts=%ud", len, ts); } else { STAT.out_count++; } } if (debug_level > 0){ stat_print(&STAT, frame_num); } return 0; }
static int translate_files(FILE *inFile, FILE *outFile) { char *Line = malloc(LINESIZE + 1); char *path = malloc(LINESIZE + 1); char *LineOut = malloc(LINESIZE + 1); int c; unsigned char ch; int i = 0; const char *pc = kdbg_cont; const char *p = kdbg_prompt; const char *p_eos = p + sizeof(KDBG_PROMPT) - 1; //end of string pos if (Line && path && LineOut) { memset(Line, '\0', LINESIZE + 1); if (opt_console) { while ((c = fgetc(inFile)) != EOF) { if (opt_quit)break; ch = (unsigned char)c; if (!opt_raw) { switch (ch) { case '\n': if ( strncmp(Line, KDBG_DISCARD, sizeof(KDBG_DISCARD)-1) == 0 ) { memset(Line, '\0', LINESIZE); // flushed } else { Line[1] = handle_escape_cmd(outFile, Line, path, LineOut); if (Line[1] != KDBG_ESC_CHAR) { if (p == p_eos) { // kdbg prompt, so already echoed char by char memset(Line, '\0', LINESIZE); translate_char(c, outFile); } else { if (match_line(outFile, Line)) { translate_line(outFile, Line, path, LineOut); translate_char(c, outFile); report(outFile); } } } } i = 0; p = kdbg_prompt; pc = kdbg_cont; break; case '<': i = 0; Line[i++] = ch; break; case '>': if (ch == *p) { p = p_eos; translate_line(outFile, Line, path, LineOut); } if (p != p_eos) { if (i < LINESIZE) { Line[i++] = ch; translate_line(outFile, Line, path, LineOut); } else { translate_line(outFile, Line, path, LineOut); translate_char(c, outFile); } } else translate_char(c, outFile); i = 0; break; default: if (ch == *p)p++; if (ch == *pc)pc++; if (i < LINESIZE) { Line[i++] = ch; if (p == p_eos) { translate_char(c, outFile); } else if (!*pc) { translate_line(outFile, Line, path, LineOut); i = 0; } } else { translate_line(outFile, Line, path, LineOut); translate_char(c, outFile); i = 0; } } } else translate_char(c, outFile); } } else { // Line by line, slightly faster but less interactive while (fgets(Line, LINESIZE, inFile) != NULL) { if (opt_quit)break; if (!opt_raw) { translate_line(outFile, Line, path, LineOut); report(outFile); } else log(outFile, "%s", Line); } } } if (opt_Revision && (strstr(opt_Revision, "regscan") == opt_Revision)) { char *s = strchr(opt_Revision, ','); if (s) { *s++ = '\0'; revinfo.range = atoi(s); } regscan(outFile); } if (opt_stats) { stat_print(outFile, &summ); if (logFile) stat_print(logFile, &summ); } free(LineOut); free(Line); free(path); return 0; }
static int show_stats_output(struct imsg *imsg) { struct stats *stats; if (imsg->hdr.type != IMSG_STATS) errx(1, "show_stats_output: bad hdr type (%d)", imsg->hdr.type); if (IMSG_DATA_SIZE(imsg) != sizeof(*stats)) errx(1, "show_stats_output: bad data size"); stats = imsg->data; stat_init(stats->counters, STATS_MAX); stat_print(STATS_CONTROL_SESSION, STAT_COUNT); stat_print(STATS_CONTROL_SESSION, STAT_ACTIVE); stat_print(STATS_CONTROL_SESSION, STAT_MAXACTIVE); stat_print(STATS_MDA_SESSION, STAT_COUNT); stat_print(STATS_MDA_SESSION, STAT_ACTIVE); stat_print(STATS_MDA_SESSION, STAT_MAXACTIVE); stat_print(STATS_MTA_SESSION, STAT_COUNT); stat_print(STATS_MTA_SESSION, STAT_ACTIVE); stat_print(STATS_MTA_SESSION, STAT_MAXACTIVE); stat_print(STATS_LKA_SESSION, STAT_COUNT); stat_print(STATS_LKA_SESSION, STAT_ACTIVE); stat_print(STATS_LKA_SESSION, STAT_MAXACTIVE); stat_print(STATS_LKA_SESSION_MX, STAT_COUNT); stat_print(STATS_LKA_SESSION_HOST, STAT_COUNT); stat_print(STATS_LKA_SESSION_CNAME, STAT_COUNT); stat_print(STATS_LKA_FAILURE, STAT_COUNT); printf("parent.uptime=%lld\n", (long long int) (time(NULL) - stats->parent.start)); stat_print(STATS_QUEUE_LOCAL, STAT_COUNT); stat_print(STATS_QUEUE_REMOTE, STAT_COUNT); stat_print(STATS_SCHEDULER, STAT_COUNT); stat_print(STATS_SCHEDULER, STAT_ACTIVE); stat_print(STATS_SCHEDULER, STAT_MAXACTIVE); stat_print(STATS_SCHEDULER_BOUNCES, STAT_COUNT); stat_print(STATS_SCHEDULER_BOUNCES, STAT_ACTIVE); stat_print(STATS_SCHEDULER_BOUNCES, STAT_MAXACTIVE); stat_print(STATS_RAMQUEUE_HOST, STAT_ACTIVE); stat_print(STATS_RAMQUEUE_BATCH, STAT_ACTIVE); stat_print(STATS_RAMQUEUE_MESSAGE, STAT_ACTIVE); stat_print(STATS_RAMQUEUE_ENVELOPE, STAT_ACTIVE); stat_print(STATS_RAMQUEUE_HOST, STAT_MAXACTIVE); stat_print(STATS_RAMQUEUE_BATCH, STAT_MAXACTIVE); stat_print(STATS_RAMQUEUE_MESSAGE, STAT_MAXACTIVE); stat_print(STATS_RAMQUEUE_ENVELOPE, STAT_MAXACTIVE); printf("smtp.errors.delays=%zd\n", stats->smtp.delays); printf("smtp.errors.linetoolong=%zd\n", stats->smtp.linetoolong); printf("smtp.errors.read_eof=%zd\n", stats->smtp.read_eof); printf("smtp.errors.read_system=%zd\n", stats->smtp.read_error); printf("smtp.errors.read_timeout=%zd\n", stats->smtp.read_timeout); printf("smtp.errors.tempfail=%zd\n", stats->smtp.tempfail); printf("smtp.errors.toofast=%zd\n", stats->smtp.toofast); printf("smtp.errors.write_eof=%zd\n", stats->smtp.write_eof); printf("smtp.errors.write_system=%zd\n", stats->smtp.write_error); printf("smtp.errors.write_timeout=%zd\n", stats->smtp.write_timeout); stat_print(STATS_SMTP_SESSION, STAT_COUNT); stat_print(STATS_SMTP_SESSION_INET4, STAT_COUNT); stat_print(STATS_SMTP_SESSION_INET6, STAT_COUNT); printf("smtp.sessions.aborted=%zd\n", stats->smtp.read_eof + stats->smtp.read_error + stats->smtp.write_eof + stats->smtp.write_error); stat_print(STATS_SMTP_SESSION, STAT_ACTIVE); stat_print(STATS_SMTP_SESSION, STAT_MAXACTIVE); printf("smtp.sessions.timeout=%zd\n", stats->smtp.read_timeout + stats->smtp.write_timeout); stat_print(STATS_SMTP_SMTPS, STAT_COUNT); stat_print(STATS_SMTP_SMTPS, STAT_ACTIVE); stat_print(STATS_SMTP_SMTPS, STAT_MAXACTIVE); stat_print(STATS_SMTP_STARTTLS, STAT_COUNT); stat_print(STATS_SMTP_STARTTLS, STAT_ACTIVE); stat_print(STATS_SMTP_STARTTLS, STAT_MAXACTIVE); return (1); }