본문 바로가기

stat

Calculation real size from results of 'df' and 'stat' "df" show result based on KB unit."stat" using block unit that it can be get from "stat"'s result. # df -h /efsFilesystem Size Used Avail Use% Mounted on/dev/block/mmcblk0p16 12M 712K 11M 6% /efs # df /efsFilesystem 1K-blocks Used Available Use% Mounted on/dev/block/mmcblk0p16 12016 712 11304 6% /efs 1K-blocks : total block count12016(KB)/1024 = 11.734712(KB) # stat -f /efs File: "/efs" ID: d360.. 더보기
파일의 속성을 check 하는 코드 - fstatat, fstat, stat, lstat 아래는 dirfd 아래에 asecName 이라는 파일이 regular file인지 check 하는 코드 ex) dirfd = "/mnt/secure/asec/" asecName = "1234" 이면 /mnt/secure/asec/1234 라는 regular file 이 있는지 check 해 준다. struct stat sb; bool ret = (fstatat(dirfd, asecName, &sb, AT_SYMLINK_NOFOLLOW) == 0) && S_ISREG(sb.st_mode); http://www.tutorialspoint.com/unix_system_calls/stat.htm The following POSIX macros are defined to check the file type usi.. 더보기
block device 의 stat 정보 해석하기 cat /sys/block//stat 의 정보 Name units description ---- ----- ----------- read I/Os requests number of read I/Os processed read merges requests number of read I/Os merged with in-queue I/O read sectors sectors number of sectors read read ticks milliseconds total wait time for read requests write I/Os requests number of write I/Os processed write merges requests number of write I/Os merged with in-.. 더보기
linux command : stat, fstat, lstat http://s2kiess.blog.me/220139796462 stat : 파일경로를 가지고 파일 속성을 가지고 온다.fstat : 파일 디스크립터를 가지고 파일 속성을 가지고 온다. 심볼릭 링크의 경우 원본 파일의 속성을 가지고 온다.lstat : fstat 과 동일하나, 심볼링 링크일 경우 링크 파일의 속성을 가지고 온다. The usage of "stat" on arm linux # statusage: stat [-f] [-c FORMAT] FILE... Display status of files or filesystems. -f display filesystem status instead of file status-c Output specified FORMAT string instead of d.. 더보기
특정 시간 동안 system cpu 사용량 구하기 (linux) 오늘은 특정시간동안의 cpu 사용량 구하는 법에 대해서 알아보고자 합니다. /proc/stat 정보를 조합하면 원하시는 정보를 얻으실 수 있습니다. cat /proc/stat 를 하시면 아래와 같은 정보를 얻을 수 있습니다. # cat /proc/stat cpu 4939 385 2406 38767 313 20 320 0 0 cpu0 4939 385 2406 38767 313 20 320 0 0 intr 102031 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 155 0 190 0 0 0 0 0 1045 0 8147 0 92 0 1286 0 0 0 0 0 0 0 0 2 0 0 0 133 0 0 0 1 0 0 0 1765 0 0 0 0 0 0 2 0 0 70437 0 0 0 0 0 0 0 0 0.. 더보기
/Proc/[pid]/stat 에서 보이는 정보 분석하기 출력되는 정보를 다음과 같은 순서로 해석하면 된다. FLDNUM FMT ARG OUTPUT 1 %d task->pid 18173 2 (%s) task->comm (run-mozilla.sh) 3 %c state S 4 %d ppid 932 5 %d task->pgrp 18173 6 %d task->session 904 7 %d tty_nr 0 8 %d tty_pgrp -1 9 %lu task->flags 0 10 %lu task->min_flt 186 11 %lu task->cmin_flt 118 12 %lu task->maj_flt 483 13 %lu task->cmaj_flt 470 14 %lu task->times.tms_utime 0 15 %lu task->times.tms_stime 0 16 %.. 더보기