• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • How to disable the buffer cache of linux fs.

    發表于:2007-07-04來源:作者:點擊數: 標簽:
    try opening the file with O_DIRECT in the flags. O_DIRECT allows reads and writes to avoid the linux fs cache 舉例; #include s td io.h #include assert.h #include sys/types.h #include sys/stat.h #include fcntl.h unsigned long long get_sys_t
    try opening the file with O_DIRECT in the flags.
    O_DIRECT allows reads and writes to avoid the linux fs cache

    舉例;

    #include <stdio.h>
    #include <assert.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <fcntl.h>

    unsigned long long get_sys_time();
    int main(int argc,char*argv[])
    {
    int i;
    int nRet=0;
    if(argc!=3)
    {
    printf("Usage:pro file size\n");
    return 0;
    }
    unsigned long long llBeg =0;
    unsigned long long llEnd =0;
    int fp;
    int nLen = atoi(argv[2]);

    char *pBuf = (char*)calloc(1,nLen);
    llBeg = get_sys_time();
    fp = open(argv[1],O_RDONLY,O_DIRECT);
    assert(fp>0);
    memset(pBuf,0,nLen);
    nRet = read(fp,pBuf,nLen);
    close(fp);
    llEnd = get_sys_time();
    free(pBuf);
    printf("readed=%d\n",nRet);
    printf("elapsed time:=%d\n",(llEnd-llBeg)/1000);
    return 0;

    }


    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>