XcopyTest_VC60_source.zip

  • PUDN用户
    了解作者
  • Visual C++
    开发工具
  • 5KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 5
    下载次数
  • 2009-11-28 09:35
    上传日期
Xcopy test aging program
XcopyTest_VC60_source.zip
  • XcopyTest.cpp
    18.6KB
  • XcopyTest.dsw
    543B
内容介绍
// #include <stdlib.h> #include <stdio.h> #include <string.h> #include <io.h> #include <time.h> #include <direct.h> #include <iostream> //#include <mapiwin.h> #define DIRECT_SCANF #define LOOPNUMBERING_ADD //copy후 read할때 cache를 동작시키지 않기위해 복사하는 화일의 이름을 //복사할때의 loop numer로 다르게 줌으로서 read를 유도.. 2005.12.21 jspark #define TARGET_ROOT //target driver root에 복사.. struct XfStruc{ _fsize_t size; char name[260]; }; // Paramter // 1. size : ex)256,512,1024 (unit Mbyte) // 2. Target Driver Name ex) E, F #ifdef DIRECT_SCANF int main(void) #else int main(int argc, char* argv[]) #endif { unsigned int i,j; unsigned int TestLoopCounter; //xcopy/compare test loop unsigned int TotalFiles,FileNo; unsigned long TotalCopyingSize; //copy해야할 size unsigned long SumCopySize,ltmp; //copy한 size #ifdef TARGET_ROOT char TargetPath[] = ":\\"; #else char TargetPath[] = ":\\MAIN\\AUDIO\\"; #endif char c1,c2,TargetFilename[260+32];//,Temp_TargetFilename[260+32]; unsigned int CompareErrorDetect; unsigned int CopyUnitSize=1; //Directory Info Structure _finddata_t CurDirInfo; long hFile; //xcopy할 화일들의 정보 XfStruc XcopyingFileInfo[1000]; //directoty내에 file이 1000개 있다고 가정... time_t StartTime,ElapsedTime; FILE *fr1, *fr2; //source,destination file FILE *flog; // log file long iSize; char *ffdata; // 데이터 저장을 위한 버퍼 선언 char DispFilename[51]; //,DosShellCmdStr[64]; #ifdef LOOPNUMBERING_ADD char NumStr[4]; #endif #ifdef DIRECT_SCANF char fsDriver[1],fsSize[4],fsUnitcopy[1]; #endif unsigned long ErrFilePositioner; if(NULL==(flog=(FILE *)fopen("log.txt","wb+"))) { printf("Output File open error!!\n"); return 0; } printf("============================================================\n"); printf(" MSC-USB stress Test for S5L8424F project models \n\n"); printf(" Caution: DATA folder should be under execution directory \n"); printf(" input paramter : Target Driver / Size / CopyUnitSector \n"); printf(" by jongseok Park (js0526.park@samsung.com), 2006.09.12 \n"); printf(" **Caution: If You have 512MB PC memory, \n"); printf(" You should have target size more than 512MB!! \n"); printf(" (As PC cache memory,Compare will be not good!) \n"); printf("============================================================\n"); #ifdef DIRECT_SCANF printf("Target Driver ? (ex: E,e) : "); scanf("%s",fsDriver); printf("Target Size(MB)? (ex: 512) : "); scanf("%s",fsSize); printf("CopyUnitSector ? ([0]: 8 sector , [1]: 64 sector) : "); scanf("%s",fsUnitcopy); CopyUnitSize = atoi(fsUnitcopy); printf("\n"); fsDriver[1]=0; #endif //start time setting.. time(&StartTime); printf("Start Time : %.24s",ctime( &( StartTime) )); fprintf(flog,"Start Time : %.24s",ctime( &( StartTime) )); #ifndef DIRECT_SCANF //input parameter 갯수 check if (argc < (2+1)) { printf("Error detected!!!\n"); printf(" usage: XcopyCompare.exe 512 Fn"); return 0; } //total xcopy size check printf("\nTargetSize: %sMB\n",argv[1]); TotalCopyingSize = (atoi(argv[1]))*1024*1024; //byte unit if (TotalCopyingSize<=0) { printf("Size Error!!!\n"); return 0; } #endif #ifdef DIRECT_SCANF TotalCopyingSize = (atoi(fsSize))*1024*1024; //byte unit if (TotalCopyingSize<=0) { printf("Size Error!!!\n"); return 0; } #endif //-------------------------------------------------------------- //현재수행되는 directory 밑의 Data folder의 filename 가져오기.. //-------------------------------------------------------------- _chdir("data"); //data folder로 이동.. if( (hFile = _findfirst( "*.*", &CurDirInfo )) == -1L ) //current folder(.)의 화일정보를 CurDirInfo로 printf( "\nNo files in current directory!\n" ); _findnext( hFile, &CurDirInfo ); //Parent Directory(..) Info FileNo = 0; while( _findnext( hFile, &CurDirInfo ) == 0 ) //나머지 directory내의 화일이 존재할때까지.. { // printf( " %-12s %.24s %9ld\n", // CurDirInfo.name, ctime( &( CurDirInfo.time_write ) ), CurDirInfo.size ); //file name/size dumping strcpy(XcopyingFileInfo[FileNo].name, CurDirInfo.name); XcopyingFileInfo[FileNo].size=CurDirInfo.size; //printf( " %-12s %9ld byte\n", // XcopyingFileInfo[FileNo].name, XcopyingFileInfo[FileNo].size ); FileNo++; //next file } TotalFiles = FileNo-1; //0 부터 count /* if( (hFile = _findfirst( "*.*", &CurDirInfo )) == -1L ) //folder의 화일정보를 CurDirInfo로 검색 printf( "\nNo files in current directory!\n" ); else { printf( "Listing of .c files\n\n" ); printf( "\nRDO HID SYS ARC FILE DATE %25c SIZE\n", ' ' ); printf( "--- --- --- --- ---- ---- %25c ----\n", ' ' ); printf( ( CurDirInfo.attrib & _A_RDONLY ) ? " Y " : " N " ); printf( ( CurDirInfo.attrib & _A_SYSTEM ) ? " Y " : " N " ); printf( ( CurDirInfo.attrib & _A_HIDDEN ) ? " Y " : " N " ); printf( ( CurDirInfo.attrib & _A_ARCH ) ? " Y " : " N " ); printf( " %-12s %.24s %9ld\n", CurDirInfo.name, ctime( &( CurDirInfo.time_write ) ), CurDirInfo.size ); // Find the rest of the .c files while( _findnext( hFile, &CurDirInfo ) == 0 ) { printf( ( CurDirInfo.attrib & _A_RDONLY ) ? " Y " : " N " ); printf( ( CurDirInfo.attrib & _A_SYSTEM ) ? " Y " : " N " ); printf( ( CurDirInfo.attrib & _A_HIDDEN ) ? " Y " : " N " ); printf( ( CurDirInfo.attrib & _A_ARCH ) ? " Y " : " N " ); printf( " %-12s %.24s %9ld\n", CurDirInfo.name, ctime( &( CurDirInfo.time_write ) ), CurDirInfo.size ); } _findclose( hFile ); } */ TestLoopCounter = 1; SumCopySize = 0; //Compare ERROR날때까지 무한 loop while(1) { printf("\n\n----------------------------------------------------------------------------"); fprintf(flog,"\n\n----------------------------------------------------------------------------"); printf("\nXcopy/Compare Test LOOP/SIZE : %d / %7.2f MB",TestLoopCounter, (float)SumCopySize/(1024*1024) ); fprintf(flog,"\nXcopy/Compare Test LOOP/SIZE : %d / %7.2f MB",TestLoopCounter, (float)SumCopySize/(1024*1024) ); time(&ElapsedTime); ltmp = (ElapsedTime - StartTime); printf("\nElasped Time => [%2ld:%2ld:%2ld]", ltmp/3600, (ltmp%3600)/60, ltmp%60 ); fprintf(flog,"\nElasped Time => [%2ld:%2ld:%2ld]", ltmp/3600, (ltmp%3600)/60, ltmp%60 ); fflush(flog); //-------------------------------------------------------------- // 저장된 복사할 화일의 정보로 target에 복사하기.. //-------------------------------------------------------------- SumCopySize = 0; FileNo = 0; printf("\n----------------------------------------------------------------------------"); while(1) { strcpy(DispFilename,XcopyingFileInfo[FileNo].name); DispFilename[50]=0; //01234567890123456789012345678901234567890123456789012345678901234567890123456789 //printf("\n "); //printf("\nCopying..%50s(%7.2fMB)",DispFilename, (float)SumCopySize/(1024*1024)); printf("\nCopying..%50s(%7.2fMB)",DispFilename, ((float)(SumCopySize+XcopyingFileInfo[FileNo].size)/(1024*1024))); //source fr1=(FILE *)fopen(XcopyingFileInfo[FileNo].name,"r
评论
    相关推荐