MCPcopy Create free account
hub / github.com/apache/trafficserver / dumpSpans

Method dumpSpans

src/traffic_cache_tool/CacheTool.cc:589–647  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

587}
588
589void
590Cache::dumpSpans(SpanDumpDepth depth)
591{
592 if (depth >= SpanDumpDepth::SPAN) {
593 for (auto span : _spans) {
594 if (nullptr == span->_header) {
595 std::cout << "Span: " << span->_path.string() << " is uninitialized" << std::endl;
596 } else {
597 std::cout << "\n----------------------------------\n"
598 << "Span: " << span->_path.string() << "\n----------------------------------\n"
599 << "#Magic: " << span->_header->magic << " #Volumes: " << span->_header->num_volumes
600 << " #in use: " << span->_header->num_used << " #free: " << span->_header->num_free
601 << " #stripes: " << span->_header->num_diskvol_blks << " Len(bytes): " << span->_header->num_blocks.value()
602 << std::endl;
603
604 for (auto stripe : span->_stripes) {
605 std::cout << "\n>>>>>>>>> Stripe " << static_cast<int>(stripe->_idx) << " @ " << stripe->_start
606 << " len=" << stripe->_len.count() << " blocks " << " vol=" << static_cast<int>(stripe->_vol_idx)
607 << " type=" << static_cast<int>(stripe->_type) << " " << (stripe->isFree() ? "free" : "in-use") << std::endl;
608
609 std::cout << " " << stripe->_segments << " segments with " << stripe->_buckets << " buckets per segment for "
610 << stripe->_buckets * stripe->_segments * ts::ENTRIES_PER_BUCKET << " total directory entries taking "
611 << stripe->_buckets * stripe->_segments * sizeof(CacheDirEntry) * ts::ENTRIES_PER_BUCKET
612 // << " out of " << (delta-header_len).units() << " bytes."
613 << std::endl;
614 if (depth >= SpanDumpDepth::STRIPE) {
615 Errata r = stripe->loadMeta();
616 if (r) {
617 // print Meta[A][HEAD]
618 std::string MetaCopy[2] = {"A", "B"};
619 std::string MetaType[2] = {"HEAD", "FOOT"};
620 for (int i = 0; i < 2; i++) {
621 for (int j = 0; j < 2; j++) {
622 std::cout << "\n" << MetaCopy[i] << ":" << MetaType[j] << "\n" << std::endl;
623 std::cout << " Magic:" << stripe->_meta[i][j].magic << "\n version: major: " << stripe->_meta[i][j].version._major
624 << "\n version: minor: " << stripe->_meta[i][j].version._minor
625 << "\n create_time: " << stripe->_meta[i][j].create_time
626 << "\n write_pos: " << stripe->_meta[i][j].write_pos
627 << "\n last_write_pos: " << stripe->_meta[i][j].last_write_pos
628 << "\n agg_pos: " << stripe->_meta[i][j].agg_pos << "\n generation: " << stripe->_meta[i][j].generation
629 << "\n phase: " << stripe->_meta[i][j].phase << "\n cycle: " << stripe->_meta[i][j].cycle
630 << "\n sync_serial: " << stripe->_meta[i][j].sync_serial
631 << "\n write_serial: " << stripe->_meta[i][j].write_serial << "\n dirty: " << stripe->_meta[i][j].dirty
632 << "\n sector_size: " << stripe->_meta[i][j].sector_size << std::endl;
633 }
634 }
635 if (!stripe->validate_sync_serial()) {
636 std::cout << "WARNING:::::Validity check failed for sync_serials" << std::endl;
637 }
638 stripe->_directory.clear();
639 } else {
640 std::cout << r;
641 }
642 }
643 }
644 }
645 }
646 }

Callers 8

List_StripesFunction · 0.80
Find_StripeFunction · 0.80
dir_checkFunction · 0.80
walk_bucket_chainFunction · 0.80
Clear_SpanFunction · 0.80
Check_FreelistFunction · 0.80
Get_ResponseFunction · 0.80
Scan_CacheFunction · 0.80

Calls 7

isFreeMethod · 0.80
loadMetaMethod · 0.80
validate_sync_serialMethod · 0.80
stringMethod · 0.45
valueMethod · 0.45
countMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected