Browse Source

checkpoint

debug-output
Antonio SJ Musumeci 2 years ago
parent
commit
5fc35874ac
  1. 7
      libfuse/lib/fuse.c
  2. 10
      libfuse/lib/fuse_msgbuf.cpp
  3. 1
      libfuse/lib/fuse_msgbuf.hpp

7
libfuse/lib/fuse.c

@ -3751,7 +3751,7 @@ metrics_log_nodes_info(struct fuse *f_,
"node memory pool avail objs: %"PRIu64"\n" "node memory pool avail objs: %"PRIu64"\n"
"node memory pool total allocated memory: %"PRIu64"\n" "node memory pool total allocated memory: %"PRIu64"\n"
"msgbuf allocation count: %"PRIu64"\n" "msgbuf allocation count: %"PRIu64"\n"
"msgbuf total allocated memory: %"PRIu64"\n"
"msgbuf available count: %"PRIu64"\n"
"\n" "\n"
, ,
(uint64_t)time_now, (uint64_t)time_now,
@ -3767,7 +3767,7 @@ metrics_log_nodes_info(struct fuse *f_,
(uint64_t)fmp_avail_objs(&f_->node_fmp.fmp), (uint64_t)fmp_avail_objs(&f_->node_fmp.fmp),
(uint64_t)fmp_total_allocated_memory(&f_->node_fmp.fmp), (uint64_t)fmp_total_allocated_memory(&f_->node_fmp.fmp),
(uint64_t)msgbuf_alloc_count(), (uint64_t)msgbuf_alloc_count(),
(uint64_t)msgbuf_alloc_count() * msgbuf_get_bufsize()
msgbuf_avail_count()
); );
lfmp_unlock(&f_->node_fmp); lfmp_unlock(&f_->node_fmp);
@ -3829,9 +3829,10 @@ fuse_maintenance_loop(void *fuse_)
if(!f->conf.nogc && gc) if(!f->conf.nogc && gc)
{ {
gc = lfmp_gc(&f->node_fmp); gc = lfmp_gc(&f->node_fmp);
// msgbuf_gc();
} }
msgbuf_gc();
if(g_LOG_METRICS) if(g_LOG_METRICS)
metrics_log_nodes_info_to_tmp_dir(f); metrics_log_nodes_info_to_tmp_dir(f);

10
libfuse/lib/fuse_msgbuf.cpp

@ -30,7 +30,6 @@
static std::uint32_t g_PAGESIZE = 0; static std::uint32_t g_PAGESIZE = 0;
static std::uint32_t g_BUFSIZE = 0; static std::uint32_t g_BUFSIZE = 0;
//static std::atomic_uint g_TOTAL_ALLOCED;
static std::mutex g_MUTEX; static std::mutex g_MUTEX;
static std::vector<fuse_msgbuf_t*> g_MSGBUF_STACK; static std::vector<fuse_msgbuf_t*> g_MSGBUF_STACK;
@ -51,7 +50,7 @@ __attribute__((destructor))
void void
msgbuf_destroy() msgbuf_destroy()
{ {
// TODO: cleanup?
msgbuf_gc();
} }
uint32_t uint32_t
@ -134,6 +133,12 @@ msgbuf_alloc_count()
return g_MSGBUF_ALLOCED.size(); return g_MSGBUF_ALLOCED.size();
} }
uint64_t
msgbuf_avail_count()
{
return g_MSGBUF_STACK.size();
}
void void
msgbuf_gc() msgbuf_gc()
{ {
@ -144,6 +149,7 @@ msgbuf_gc()
oldstack.swap(g_MSGBUF_STACK); oldstack.swap(g_MSGBUF_STACK);
} }
fprintf(stderr,"freeing %lu msgbufs\n",oldstack.size());
for(auto msgbuf: oldstack) for(auto msgbuf: oldstack)
{ {
g_MSGBUF_ALLOCED.erase(msgbuf); g_MSGBUF_ALLOCED.erase(msgbuf);

1
libfuse/lib/fuse_msgbuf.hpp

@ -32,5 +32,6 @@ void msgbuf_free(fuse_msgbuf_t *msgbuf);
void msgbuf_gc(); void msgbuf_gc();
uint64_t msgbuf_alloc_count(); uint64_t msgbuf_alloc_count();
uint64_t msgbuf_avail_count();
EXTERN_C_END EXTERN_C_END
Loading…
Cancel
Save