]> sigrok.org Git - libsigrok.git/commit
baylibre-acme: Optimize reading of values from sysfs.
authorDaniel Lezcano <redacted>
Wed, 27 May 2015 18:22:02 +0000 (20:22 +0200)
committerBartosz Golaszewski <redacted>
Mon, 29 Jun 2015 14:07:52 +0000 (16:07 +0200)
commit4e88b86cc81ce6569c4bbf947fc2f0f47f4ce8a1
tree9694673a2dfb7848b71f5a945c965422997ed5a7
parentfe473123ba836445d477149f2e2c0ae372fc0c4c
baylibre-acme: Optimize reading of values from sysfs.

Opening a file has a cost (security, allocation, syscalls). The
read_sample() function always does an open/read/close sequence.

In order to optimize that, let's open the file at the moment the
acquisition starts, close it when the acquisition stops and make
read_sample() only lseek() to the beginning of the file and read
the value.

Signed-off-by: Daniel Lezcano <redacted>
Signed-off-by: Bartosz Golaszewski <redacted>
src/hardware/baylibre-acme/api.c
src/hardware/baylibre-acme/protocol.c
src/hardware/baylibre-acme/protocol.h