Commit f8d84e55 authored by Ramon Nou's avatar Ramon Nou
Browse files

Metrics should be nicely cleanup, add destroy_metrics function

parent e4755bfa
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
  - Support to print newer syscall (although not implemented). Added syscall number to log for easy capture missing ones.
- Unify dependency scripts (dl and compile): Unify `-d` and `-p` flags ([!174](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/174)).
- Increased merge assert for files with size 0, specific for DLIO with GekkoFS in Debug ([!208])(https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/208)).
- Added code to correct fork issues. `pthread_at_fork` cleans and starts GekkoFS ([!210](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/210)).
### Removed
### Fixed

+3 −0
Original line number Diff line number Diff line
@@ -153,6 +153,9 @@ public:
    bool
    init_metrics();

    void
    destroy_metrics();

    void
    mountdir(const std::string& path);

+1 −7
Original line number Diff line number Diff line
@@ -413,6 +413,7 @@ destroy_preload() {
    CTX->read_metrics()->flush_msgpack();
    LOG(INFO, "Metrics flushed. Total flush operations: {}",
        CTX->write_metrics()->flush_count());
    CTX->destroy_metrics();
#endif
    CTX->clear_hosts();
    LOG(DEBUG, "Peer information deleted");
@@ -468,21 +469,14 @@ gkfs_end() {

void
at_fork_syscall() {
    printf("%d ->At fork, %d\n", gettid(), CTX->interception_enabled());
    destroy_preload();
}
void
at_parent_syscall() {
    printf("%d ->At fork parent %d\n", gettid(), CTX->interception_enabled());
    init_preload();
    printf("%d -> x At fork parent %d\n", gettid(),
           CTX->interception_enabled());
}

void
at_child_syscall() {

    printf("%d ->At fork child %d\n", gettid(), CTX->interception_enabled());
    init_preload();
    printf("%d -> x At fork child %d\n", gettid(), CTX->interception_enabled());
}
+8 −0
Original line number Diff line number Diff line
@@ -121,6 +121,14 @@ PreloadContext::init_logging() {
    );
}

void
PreloadContext::destroy_metrics() {
#ifdef GKFS_ENABLE_CLIENT_METRICS
    write_metrics_.reset();
    read_metrics_.reset();
#endif
}

bool
PreloadContext::init_metrics() {
#ifdef GKFS_ENABLE_CLIENT_METRICS