⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dtstats.c

📁 Linux磁盘测试的源代码,测试磁盘的读写性能
💻 C
📖 第 1 页 / 共 2 页
字号:
		    Lprintf ("\n");		}	    } else {		struct dinfo *dip = output_dinfo;		struct dtype *dtp = dip->di_dtype;		Lprintf ("%30.30s%s",				"Output device/file name: ", output_file);		if (output_dtype->dt_dtype != DT_UNKNOWN) {		    if (dip->di_device != NULL) {			Lprintf (" (Device: %s, type=%s)\n",					dip->di_device, dtp->dt_type);		    } else {			Lprintf (" (device type=%s)\n", dtp->dt_type);		    }		} else {		    Lprintf ("\n");		}	    }	    Lprintf ("%30.30s", "Type of I/O's performed: ");	    if (io_type == RANDOM_IO) {		Lprintf ("random (rseed=%#x", random_seed);	    } else {		Lprintf ("sequential (%s",			(io_dir == FORWARD) ? "forward" : "reverse");		if (variable_flag) {		    Lprintf (", rseed=%#x", random_seed);		}	    }	    if (raw_flag) {		Lprintf (", read-after-write)\n");	    } else {		Lprintf(")\n");	    }	    if (io_type == RANDOM_IO) {		Lprintf ("%30.30s", "Random I/O Parameters: ");		Lprintf ("position=" FUF ", ralign=%ld, rlimit=" LUF "\n",			file_position, random_align, rdata_limit);	    } else if (num_slices) {		Lprintf ("%30.30s", "Slice Range Parameters: ");		Lprintf ("position=" FUF " (lba %u), limit=" LUF "\n",		file_position, (u_int32)(file_position / dip->di_dsize), data_limit);	    }	    if (align_offset || rotate_flag) {		Lprintf ("%30.30s", "Buffer alignment options: ");		if (align_offset) {		    Lprintf ("alignment offset = %d bytes\n", align_offset);		} else {		    Lprintf ("rotating through 1st %d bytes\n", ROTATE_SIZE);		}	    }	}	if (num_procs || num_slices) {	    Lprintf ("%30.30s%d/%d\n",			(num_slices) ? "Current Slice Reported: "				     : "Current Process Reported: ",					cur_proc,			(num_procs) ? num_procs : num_slices);	}#if defined(TTY)	if (ttyport_flag && (stats_type == TOTAL_STATS)) {	    Lprintf ("%30.30sflow=%s, parity=%s, speed=%s\n",				"Terminal characteristics: ",				flow_str, parity_str, speed_str);	}#endif /* defined(TTY) */    if (io_mode == TEST_MODE) {	/*	 * Extra information regarding pattern verification.	 */	bzero (pinfo, sizeof(*pinfo));	if (output_file && !verify_flag) {	    pinfo = " (read verify disabled)";	} else if (!compare_flag) {	    pinfo = " (data compare disabled)";	} else if (incr_pattern) {	    sprintf(pinfo, " (incrementing 0-255)");	} else if (iot_pattern) {	    sprintf(pinfo, " (blocking is %u bytes)", lbdata_size);	} else if (pattern_file || pattern_string) {	    sprintf(pinfo, " (first %u bytes)", sizeof(pattern));	} else if (lbdata_flag) {	    sprintf(pinfo, " (w/lbdata, lba %u, size %u bytes)",					 lbdata_addr, lbdata_size);	}	if (stats_type == TOTAL_STATS) {	    if (prefix_string) {		Lprintf ("%30.30s'%s'\n",			"Data pattern prefix used: ", prefix_string);	    }	    if (pattern_file) {		Lprintf ("%30.30s%s (%lu bytes)\n",			"Data pattern file used: ", pattern_file, patbuf_size);	    } else if (pattern_string) {		Lprintf ("%30.30s'%s'%s\n",				"Data pattern string used: ", pattern_string,				(iot_pattern) ? pinfo : "");	    }	    if (!iot_pattern) {	      if (output_file && verify_flag) {		Lprintf ("%30.30s0x%08x%s\n",				"Data pattern read/written: ", pattern, pinfo);	      } else if (output_file && !verify_flag) {		Lprintf ("%30.30s0x%08x%s\n",				"Data pattern written: ", pattern, pinfo);	      } else {		Lprintf ("%30.30s0x%08x%s\n",				"Data pattern read: ", pattern, pinfo);	      }	    }	} else if ( (pass_limit > 1L) && !pattern_file ) {	    if (stats_type == READ_STATS) {		Lprintf ("%30.30s0x%08x%s\n",				"Data pattern read: ", pattern, pinfo);	    } else {		Lprintf ("%30.30s0x%08x\n",				"Data pattern written: ", pattern, pinfo);	    }	}    } else { /* !TEST_MODE */	if ( (stats_type == COPY_STATS) ||	     ((stats_type == TOTAL_STATS) && !verify_flag) ) {	    Lprintf ("%30.30sCopied '%s' to '%s'.\n",				data_op_str,				input_dinfo->di_dname,				output_dinfo->di_dname);	} else if ( (stats_type == VERIFY_STATS) ||		    ((stats_type == TOTAL_STATS) && verify_only) ) {	    Lprintf ("%30.30sVerified '%s' with '%s'.\n",				data_op_str,				input_dinfo->di_dname,				output_dinfo->di_dname);	}    } /* end 'if (io_mode == TEST_MDOE)' */	if (min_size) {	    Lprintf ("%30.30s" LUF " with min=%ld, max=%ld, incr=",				"Total records processed: ",				(xfer_records + xfer_partial),				min_size, max_size);	    if (variable_flag) {		Lprintf ("variable\n");	    } else {		Lprintf ("%ld\n", incr_count);	    }	} else {	    Lprintf ("%30.30s" LUF " @ %ld bytes/record",				"Total records processed: ",				xfer_records, block_size);	    if (xfer_partial) {		Lprintf (", %lu partial\n", xfer_partial);	    } else {		Lprintf (" (%.3f Kbytes)\n",				((double)block_size / (double) KBYTE_SIZE));	    }	}    #if !defined(__GNUC__) && defined(_NT_SOURCE)    /* Avoid:  error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64 */	Kbytes = (double) ( (double)(slarge_t) xfer_bytes / (double) KBYTE_SIZE);	Mbytes = (double) ( (double)(slarge_t) xfer_bytes / (double) MBYTE_SIZE);#else /* !defined(_NT_SOURCE) */	Kbytes = (double) ( (double) xfer_bytes / (double) KBYTE_SIZE);	Mbytes = (double) ( (double) xfer_bytes / (double) MBYTE_SIZE);#endif /* !defined(__GNUC__) && defined(_NT_SOURCE) */	    	Lprintf ("%30.30s" LUF " (%.3f Kbytes, %.3f Mbytes)\n",				"Total bytes transferred: ",				xfer_bytes, Kbytes, Mbytes);	/*	 * Calculate the total clock ticks (hz = ticks/second).	 */	if (et) {#if !defined(__GNUC__) && defined(_NT_SOURCE)	    bytes_sec = ((double)(slarge_t)xfer_bytes / ((double)et / (double)hz));#else /* !defined(_NT_SOURCE) */	    bytes_sec = ((double)xfer_bytes / ((double)et / (double)hz));#endif /* !defined(__GNUC__) && defined(_NT_SOURCE) */	} else {	    bytes_sec = 0.0;	}#if !defined(__GNUC__) && defined(_NT_SOURCE)	kbytes_sec = (double) ( (double) bytes_sec / (double) KBYTE_SIZE);#else /* !defined(_NT_SOURCE) */        kbytes_sec = (double) ( (double) bytes_sec / (double) KBYTE_SIZE);#endif /* !defined(__GNUC__) && defined(_NT_SOURCE) */	Lprintf ("%30.30s%.0f bytes/sec, %.3f Kbytes/sec\n",				"Average transfer rates: ",				bytes_sec, kbytes_sec);#if defined(AIO)	if (stats_type == TOTAL_STATS) {	    if (aio_flag) {		Lprintf("%30.30s%d\n", "Asynchronous I/O's used: ", aio_bufs);	    }	}#endif /* defined(AIO) */	if (et && xfer_records) {#if !defined(__GNUC__) && defined(_NT_SOURCE)	    double records = (double)(slarge_t)(xfer_records + xfer_partial);#else /* !defined(_NT_SOURCE) */	    double records = (double)(xfer_records + xfer_partial);#endif /* !defined(__GNUC__) && defined(_NT_SOURCE) */	    ios_sec = (records / ((double)et / (double)hz));	} else {	    ios_sec = 0.0;	}	Lprintf ("%30.30s%.3f\n", "Number I/O's per second: ", ios_sec);	if (multi_flag || volumes_flag) {	    Lprintf ("%30.30s", "Total volumes completed: ");	    if (volumes_flag) {		Lprintf ("%d/%d\n", multi_volume, volume_limit);	    } else {		Lprintf ("%d\n", multi_volume);	    }	}	Lprintf ("%30.30s", "Total passes completed: ");	if (runtime) {	    Lprintf ("%lu\n", pass_count);	} else {	    Lprintf ("%lu/%lu\n", pass_count, pass_limit);	}	if (file_limit) {	    if ((stats_type == TOTAL_STATS) && output_file && verify_flag) {		/*		 * When writing/reading multiple tape files, we'll actually		 * process double the specified number of file marks.		 */		if (total_files > file_limit) {		    file_limit *= 2;	/* Make stats look kosher... */		}	    }	    Lprintf ("%30.30s", "Total files processed: ");	    if ((stats_type == TOTAL_STATS) && pass_count && total_files) {		Lprintf (LUF "/" LUF "\n", total_files,				((large_t)pass_count * (large_t)file_limit));	    } else {		u_long files = (dip->di_files_read + dip->di_files_written);		Lprintf ("%lu/%lu\n", files, file_limit);	    }	}	Lprintf ("%30.30s%lu/%lu",				"Total errors detected: ",	    (stats_type == TOTAL_STATS) ? total_errors : error_count,						error_limit);	if (stats_type == TOTAL_STATS) {	    if ( (total_errors == 0) &&		 (exit_status != SUCCESS) && (exit_status != END_OF_FILE) ) {		Lprintf (" (exit status is %u!)");	    }	}	Lprintf("\n");	/*	 * Report elapsed, user, and system times.	 */	Lprintf ("%30.30s", "Total elapsed time: ");	format_time (et);	/*	 * More ugliness for Windows, since the system and	 * user times are always zero, don't display them.	 */	Lprintf ("%30.30s", "Total system time: ");	at = etms->tms_stime - stms->tms_stime;	at += etms->tms_cstime - stms->tms_cstime;	format_time (at);	Lprintf ("%30.30s", "Total user time: ");	at = etms->tms_utime - stms->tms_utime;	at += etms->tms_cutime - stms->tms_cutime;	format_time (at);#if defined(DEC)	if (table_flag) {	    if ( (etbl->si_hz != stbl->si_hz) ) {		Fprintf ("Inconsistency! etbl->si_hz = %ld, stbl->si_hz = %ld\n",								etbl->si_hz, stbl->si_hz);	    }	    table_user = (etbl->si_user - stbl->si_user);	    table_sys = (etbl->si_sys - stbl->si_sys);	    table_idle = (etbl->si_idle - stbl->si_idle);	    table_wait = (etbl->wait - stbl->wait);	    Lprintf ("%30.30s", "Table system time: ");	    format_ltime(table_sys, (int)stbl->si_hz);	    Lprintf ("%30.30s", "Table user time: ");	    format_ltime (table_user, (int)stbl->si_hz);	    Lprintf ("%30.30s", "Table idle time: ");	    format_ltime (table_idle, (int)stbl->si_hz);	    Lprintf ("%30.30s", "Table wait time: ");	    format_ltime (table_wait, (int)stbl->si_hz);	}#endif /* defined(DEC) */	Lprintf ("%30.30s", "Starting time: ");	Ctime(program_start);	program_end = time((time_t) 0);	Lprintf ("%30.30s", "Ending time: ");	Ctime(program_end);	Lprintf ("\n");	Lflush();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -