Skip to content

Commit

Permalink
Extend state explorer to show posting list cache.
Browse files Browse the repository at this point in the history
  • Loading branch information
toregge committed Nov 22, 2024
1 parent 3d8c7c5 commit fc6ed08
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion searchcore/src/vespa/searchcore/proton/server/proton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <vespa/searchlib/transactionlog/trans_log_server_explorer.h>
#include <vespa/searchlib/transactionlog/translogserverapp.h>
#include <vespa/searchlib/util/fileheadertk.h>
#include <vespa/vespalib/data/slime/slime.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/net/http/state_server.h>
#include <vespa/vespalib/util/blockingthreadstackexecutor.h>
Expand Down Expand Up @@ -998,11 +999,25 @@ struct DocumentDBMapExplorer : vespalib::StateExplorer {
}
};

void insert_cache_stats(Cursor& object, const vespalib::CacheStats& stats)
{
object.setLong("hits", stats.hits);
object.setLong("misses", stats.misses);
object.setLong("elements", stats.elements);
object.setLong("memory_used", stats.memory_used);
object.setLong("lookups", stats.lookups());
}

} // namespace proton::<unnamed>

void
Proton::get_state(const vespalib::slime::Inserter &, bool) const
Proton::get_state(const vespalib::slime::Inserter &inserter, bool) const
{
if (_posting_list_cache) {
auto& object = inserter.insertObject().setObject("cache");
insert_cache_stats(object.setObject("postinglist"), _posting_list_cache->get_stats());
insert_cache_stats(object.setObject("bitvector"), _posting_list_cache->get_stats());
}
}

std::vector<std::string>
Expand Down

0 comments on commit fc6ed08

Please sign in to comment.