Skip to content

Commit

Permalink
issue#6: Add benchmark for opening device files
Browse files Browse the repository at this point in the history
As we found out in <#6>,
opening the character device special files for the more modern
evdev API takes about 5000 times the time needed for opening the
device for the old console API:

    console API
        device name: /dev/ttyN (e.g. /dev/tty4)
        time per open-and-close cycle: about 3us

    evdev API
        device name: /dev/input/by-path/platform-pcspkr-event-spkr
        time per open-and-close cycle: about 15ms

To help with measuring those times, and timing them with
/usr/bin/time we have now added "issue-6-benchmark".

Run "make issue-6-benchmark" to build "issue-6-benchmark".

Read "issue-6-benchmark.c" or run "issue-6-benchmark --help"
for usage information.

One peculiar thing to note is that apparently, the evdev API
takes neither User time nor System time, but still needs wall
clock time:

	Command being timed: "./issue-6-benchmark 5118303 /dev/tty2"
	User time (seconds): 0.54
	System time (seconds): 13.37
	Percent of CPU this job got: 94%
	Elapsed (wall clock) time (h:mm:ss or m:ss): 0:14.75

	Command being timed: "./issue-6-benchmark 958 /dev/input/by-path/platform-pcspkr-event-spkr"
	User time (seconds): 0.00
	System time (seconds): 0.07
	Percent of CPU this job got: 0%
	Elapsed (wall clock) time (h:mm:ss or m:ss): 0:14.66
  • Loading branch information
ndim committed Dec 20, 2019
1 parent da7b600 commit f3d8781
Show file tree
Hide file tree
Showing 3 changed files with 637 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/beep
/*.clang
/*.gcc
/issue-6-benchmark

# Built sources
/beep-usage.c
Expand Down
4 changes: 4 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ beep_OBJS += beep-library.o
beep_OBJS += beep-usage.o
beep_OBJS += beep-drivers.o

check_PROGRAMS += issue-6-benchmark
issue_6_benchmark_OBJS = issue-6-benchmark.o
issue_6_benchmark_LIBS = -lm

# The drivers here use `__attribute__((constructor))` functions to
# register themselves with `beep_drivers_register()`, so the last one
# listed here will be linked last and have its constructor called at
Expand Down
Loading

0 comments on commit f3d8781

Please sign in to comment.