summaryrefslogtreecommitdiff
path: root/ft
diff options
context:
space:
mode:
authorLeif Walsh <leif@tokutek.com>2012-12-06 22:38:09 +0000
committerYoni Fogel <yoni@tokutek.com>2013-04-17 00:01:21 -0400
commit0ecaed8724f2a5f107f61e526c61f432f0df8933 (patch)
treedef580f1a6594b4b4075f0cdadf6c48c608a3a86 /ft
parent95047c4648decb689a83b11e0f9de0c9118c493b (diff)
downloadmariadb-git-0ecaed8724f2a5f107f61e526c61f432f0df8933.tar.gz
refs #5758 add --tsv to ftdump to produce fragmentation data all on one line
git-svn-id: file:///svn/toku/tokudb@50850 c7de825b-a66e-492c-adef-691d508d4ae1
Diffstat (limited to 'ft')
-rw-r--r--ft/ftdump.cc24
1 files changed, 16 insertions, 8 deletions
diff --git a/ft/ftdump.cc b/ft/ftdump.cc
index 60f4762794d..885784f1988 100644
--- a/ft/ftdump.cc
+++ b/ft/ftdump.cc
@@ -231,16 +231,21 @@ dump_block_translation(FT h, uint64_t offset) {
}
static void
-dump_fragmentation(int UU(f), FT h) {
+dump_fragmentation(int UU(f), FT h, int tsv) {
int64_t used_space;
int64_t total_space;
toku_blocktable_internal_fragmentation(h->blocktable, &total_space, &used_space);
int64_t fragsizes = total_space - used_space;
- printf("used_size\t%" PRId64 "\n", used_space);
- printf("total_size\t%" PRId64 "\n", total_space);
- printf("fragsizes\t%" PRId64 "\n", fragsizes);
- printf("fragmentation\t%.1f\n", 100. * ((double)fragsizes / (double)(total_space)));
+ if (tsv) {
+ printf("%" PRId64 "\t%" PRId64 "\t%" PRId64 "\t%.1f\n", used_space, total_space, fragsizes,
+ 100. * ((double)fragsizes / (double)(total_space)));
+ } else {
+ printf("used_size\t%" PRId64 "\n", used_space);
+ printf("total_size\t%" PRId64 "\n", total_space);
+ printf("fragsizes\t%" PRId64 "\n", fragsizes);
+ printf("fragmentation\t%.1f\n", 100. * ((double)fragsizes / (double)(total_space)));
+ }
}
typedef struct {
@@ -415,7 +420,7 @@ split_fields (char *line, char *fields[], int maxfields) {
static int
usage(const char *arg0) {
- printf("Usage: %s [--nodata] [--i[nteractive]|--fragmentation|--translation-table|--rootnode] ftfilename\n", arg0);
+ printf("Usage: %s [--nodata] [--i[nteractive]|--fragmentation [--tsv]|--translation-table|--rootnode] ftfilename\n", arg0);
return 1;
}
@@ -461,6 +466,7 @@ main (int argc, const char *const argv[]) {
int fragmentation = 0;
int translation_table = 0;
int rootnode = 0;
+ int tsv = 0;
const char *arg0 = argv[0];
argc--; argv++;
@@ -471,6 +477,8 @@ main (int argc, const char *const argv[]) {
interactive = 1;
} else if (strcmp(argv[0], "--fragmentation") == 0) {
fragmentation = 1;
+ } else if (strcmp(argv[0], "--tsv") == 0) {
+ tsv = 1;
} else if (strcmp(argv[0], "--translation-table") == 0) {
translation_table = 1;
} else if (strcmp(argv[0], "--rootnode") == 0) {
@@ -533,7 +541,7 @@ main (int argc, const char *const argv[]) {
offset = getuint64(fields[1]);
dump_block_translation(ft, offset);
} else if (strcmp(fields[0], "fragmentation") == 0) {
- dump_fragmentation(f, ft);
+ dump_fragmentation(f, ft, tsv);
} else if (strcmp(fields[0], "nodesizes") == 0) {
dump_nodesizes(f, ft);
} else if (strcmp(fields[0], "garbage") == 0) {
@@ -556,7 +564,7 @@ main (int argc, const char *const argv[]) {
} else if (rootnode) {
dump_node(f, ft->h->root_blocknum, ft);
} else if (fragmentation) {
- dump_fragmentation(f, ft);
+ dump_fragmentation(f, ft, tsv);
} else if (translation_table) {
toku_dump_translation_table_pretty(stdout, ft->blocktable);
} else {