Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yutotnh/execution_time_of_file_existence_check
This is used to measure the execution time of the process of checking for the existence of a file.
https://github.com/yutotnh/execution_time_of_file_existence_check
c
Last synced: about 2 months ago
JSON representation
This is used to measure the execution time of the process of checking for the existence of a file.
- Host: GitHub
- URL: https://github.com/yutotnh/execution_time_of_file_existence_check
- Owner: yutotnh
- License: mit
- Created: 2023-08-10T14:54:46.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-17T22:48:03.000Z (over 1 year ago)
- Last Synced: 2023-08-18T00:18:31.881Z (over 1 year ago)
- Topics: c
- Language: C
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# execution_time_of_file_existence_check
This is used to measure the execution time of the process of checking for the existence of a file.
There are three file checking processes, each using the following functions.
- access
- stat
- fopen## Usage
```text
Usage: ./a.out [FILE] [LOOP_COUNT]
```## Example
```console
gcc main.c
./a.out dir
```## Result
CPU : AMD Ryzen 5 5600X 6-Core Processor
```console
$ uname --kernel-name --kernel-release --kernel-version --machine --operating-system --hardware-platform --processor
Linux 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy
$ mkdir dir
$ cd dir
$ for i in {1..100000}; do dd if=/dev/zero of=file$i bs=1024 count=1; done
$ cd ..
$ sudo sh -c "echo 3 >'/proc/sys/vm/drop_caches' && swapoff -a && swapon -a"
$ gcc main.c
$ ./a.out dir
stat:4.8385e-07
access:5.5645e-07
fopen:9.8323e-07
```