diff --git a/core/metrics.c b/core/metrics.c index f20ab2b7..7854a941 100644 --- a/core/metrics.c +++ b/core/metrics.c @@ -72,6 +72,41 @@ extern struct uwsgi_server uwsgi; */ +int64_t uwsgi_metric_get_from_file(char *filename, int split_pos) { + char buf[4096]; + int64_t ret = 0; + int fd = open(filename, O_RDONLY); + if (fd < 0) { + uwsgi_error_open(filename); + return 0; + } + + ssize_t rlen = read(fd, buf, 4096); + if (rlen <= 0) goto end; + + char *ptr = buf; + ssize_t i; + int pos = 0; + for(i=0;i