Created
May 1, 2019 15:24
-
-
Save Avatat/9691670df3be67ec8e88f75480c8f932 to your computer and use it in GitHub Desktop.
cat | grep vs grep
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # strace -cf sh -c "cat 101Mb_file | grep string" | |
| strace: Process 5094 attached | |
| strace: Process 5095 attached | |
| % time seconds usecs/call calls errors syscall | |
| ------ ----------- ----------- --------- --------- ---------------- | |
| 92.34 0.148169 74085 2 wait4 | |
| 6.02 0.009665 12 804 write | |
| 1.64 0.002630 2 1664 read | |
| 0.00 0.000000 0 18 4 open | |
| 0.00 0.000000 0 24 1 close | |
| 0.00 0.000000 0 14 10 stat | |
| 0.00 0.000000 0 17 fstat | |
| 0.00 0.000000 0 41 mmap | |
| 0.00 0.000000 0 18 mprotect | |
| 0.00 0.000000 0 10 munmap | |
| 0.00 0.000000 0 9 brk | |
| 0.00 0.000000 0 9 rt_sigaction | |
| 0.00 0.000000 0 1 rt_sigprocmask | |
| 0.00 0.000000 0 2 rt_sigreturn | |
| 0.00 0.000000 0 2 1 ioctl | |
| 0.00 0.000000 0 12 12 access | |
| 0.00 0.000000 0 1 pipe | |
| 0.00 0.000000 0 2 dup2 | |
| 0.00 0.000000 0 1 getpid | |
| 0.00 0.000000 0 2 clone | |
| 0.00 0.000000 0 3 execve | |
| 0.00 0.000000 0 1 getrlimit | |
| 0.00 0.000000 0 1 getuid | |
| 0.00 0.000000 0 1 getgid | |
| 0.00 0.000000 0 2 geteuid | |
| 0.00 0.000000 0 1 getegid | |
| 0.00 0.000000 0 1 getppid | |
| 0.00 0.000000 0 3 arch_prctl | |
| 0.00 0.000000 0 1 futex | |
| 0.00 0.000000 0 1 set_tid_address | |
| 0.00 0.000000 0 1 fadvise64 | |
| 0.00 0.000000 0 1 set_robust_list | |
| ------ ----------- ----------- --------- --------- ---------------- | |
| 100.00 0.160464 2670 28 total | |
| # strace -cf sh -c "grep string 101Mb_file" | |
| strace: Process 5099 attached | |
| % time seconds usecs/call calls errors syscall | |
| ------ ----------- ----------- --------- --------- ---------------- | |
| 61.94 0.060000 60000 1 wait4 | |
| 38.06 0.036868 450 82 read | |
| 0.00 0.000000 0 9 open | |
| 0.00 0.000000 0 12 close | |
| 0.00 0.000000 0 8 5 stat | |
| 0.00 0.000000 0 11 fstat | |
| 0.00 0.000000 0 2 lseek | |
| 0.00 0.000000 0 32 mmap | |
| 0.00 0.000000 0 14 mprotect | |
| 0.00 0.000000 0 8 munmap | |
| 0.00 0.000000 0 6 brk | |
| 0.00 0.000000 0 9 rt_sigaction | |
| 0.00 0.000000 0 1 rt_sigprocmask | |
| 0.00 0.000000 0 1 rt_sigreturn | |
| 0.00 0.000000 0 2 1 ioctl | |
| 0.00 0.000000 0 9 9 access | |
| 0.00 0.000000 0 1 getpid | |
| 0.00 0.000000 0 1 clone | |
| 0.00 0.000000 0 2 execve | |
| 0.00 0.000000 0 1 getrlimit | |
| 0.00 0.000000 0 1 getuid | |
| 0.00 0.000000 0 1 getgid | |
| 0.00 0.000000 0 2 geteuid | |
| 0.00 0.000000 0 1 getegid | |
| 0.00 0.000000 0 1 getppid | |
| 0.00 0.000000 0 2 arch_prctl | |
| 0.00 0.000000 0 1 futex | |
| 0.00 0.000000 0 1 set_tid_address | |
| 0.00 0.000000 0 1 openat | |
| 0.00 0.000000 0 1 set_robust_list | |
| ------ ----------- ----------- --------- --------- ---------------- | |
| 100.00 0.096868 224 15 total |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment