ログファイルのエントリ数、合計サイズを出力するようにした

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/branches/20080626_SDK500fc_plus5_branch@1775 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
aoki_ryoma 2008-07-04 00:00:42 +00:00
parent 4e1a7ad011
commit 87b2a11270

View File

@ -11,8 +11,8 @@
in whole or in part, without the prior written consent of Nintendo. in whole or in part, without the prior written consent of Nintendo.
$Date:: $ $Date:: $
$Rev:$ $Rev$
$Author:$ $Author$
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
#include <twl.h> #include <twl.h>
@ -21,7 +21,7 @@
// なぜかバッファサイズが256byteを超えると出力が欠けるようになる // なぜかバッファサイズが256byteを超えると出力が欠けるようになる
// ダンプを見ると、OS_TPrintf()呼び出し時にもバッファにはちゃんと格納されている模様 // ダンプを見ると、OS_TPrintf()呼び出し時にもバッファにはちゃんと格納されている模様
// 原因は現在調査中 // 原因は現在調査中
#define BUFSIZE 250 #define BUFSIZE 128
void VBlankIntr(void); void VBlankIntr(void);
@ -60,17 +60,25 @@ void TwlMain( void )
// ログファイルの中身を出力 // ログファイルの中身を出力
FSFile file; FSFile file;
char buf[BUFSIZE+1]; char buf[BUFSIZE+1];
int numEntry = 0;
int totalSize = 0, nowSize = 0;
buf[BUFSIZE] = '\0'; buf[BUFSIZE] = '\0';
FS_InitFile( &file ); FS_InitFile( &file );
FS_OpenFileEx( &file, "nand:/sys/log/sysmenu.log", FS_FILEMODE_R ); FS_OpenFileEx( &file, "nand:/sys/log/sysmenu.log", FS_FILEMODE_R );
while( FS_ReadFile( &file, buf, BUFSIZE ) == BUFSIZE ) while( ( nowSize = FS_ReadFile( &file, buf, BUFSIZE ) ) == BUFSIZE )
{ {
OS_TPrintf("%s",buf); OS_TPrintf("%s",buf);
numEntry++;
totalSize += nowSize;
} }
OS_TPrintf("%s\n",buf); OS_TPrintf("%s\n",buf);
totalSize += nowSize;
OS_TPrintf("num entry : %d\n", numEntry );
OS_TPrintf("total Size : %d\n", totalSize);
} }
OS_TPrintf( "*** End of demo\n" ); OS_TPrintf( "*** End of demo\n" );