Skip to content

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

@seanvaleo

Description

@seanvaleo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions