appview icon indicating copy to clipboard operation
appview copied to clipboard

The fs.read metric is not produced when we read a file

Open seanvaleo opened this issue 2 years ago • 0 comments

When we read a file with this test app (calling read or __read_chk), I observed that we do not produce an fs.read metric event. Also, in the fs.close event associated with the file read, file_read_bytes does not change from 0.

#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>

#define SIZE 512
static int fd;
static char buf[SIZE];

void verify_read(void) {
	//__read_chk(fd, buf, SIZE, SIZE);
	read(fd, buf, SIZE);
}

void setup(void) {
	memset(buf, '*', SIZE);
	fd = open("testfile", O_RDWR | O_CREAT, 0700);
	write(fd, buf, SIZE);
}

void cleanup(void) {
	if (fd > 0) close(fd);
}

int main() {
	setup();
	verify_read();
	cleanup();
}

We do see expected results using other commands:

SCOPE_EVENT_METRIC=true ./bin/linux/x86_64/scope head [some file]
scope events

seanvaleo avatar Oct 09 '23 01:10 seanvaleo