diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-03-09 13:35:46 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-03-09 13:35:46 +0100 |
commit | 27821c298d6f61b025e400812cdd71871c1e3982 (patch) | |
tree | 377a8ae20b41f46631db2098c1b8eb41f477bce9 /storage | |
parent | 7f3e8265707321bf3156e2fe4d4f6e56d17ed557 (diff) |
Deinline destructorsi and use -Winline gcc option.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/src/vespa/storage/tools/analyzedistribution.cpp | 89 | ||||
-rw-r--r-- | storage/src/vespa/storage/tools/generatedistributionbits.cpp | 60 | ||||
-rw-r--r-- | storage/src/vespa/storage/tools/getidealstate.cpp | 71 | ||||
-rw-r--r-- | storage/src/vespa/storage/tools/statfs.cpp | 31 | ||||
-rw-r--r-- | storage/src/vespa/storage/tools/throttlingsim.h | 14 |
5 files changed, 136 insertions, 129 deletions
diff --git a/storage/src/vespa/storage/tools/analyzedistribution.cpp b/storage/src/vespa/storage/tools/analyzedistribution.cpp index b2b95c15d30..0368e46c668 100644 --- a/storage/src/vespa/storage/tools/analyzedistribution.cpp +++ b/storage/src/vespa/storage/tools/analyzedistribution.cpp @@ -23,42 +23,40 @@ struct Options : public vespalib::ProgramOptions { double redundancy; std::string testdir; - Options(int argc, const char* const* argv) - : vespalib::ProgramOptions(argc, argv), - showSyntaxPage(false), - systemState(""), - numDisks(0), - diskDistribution(1), - redundancy(2.0) - { - setSyntaxMessage( - "Analyzes distribution from a real cluster. " - "This tool reads gzipped files containing directory " - "listings from a live system and analyze how current " - "distribution and ideal distribution is in that cluster." - "The tool is typically run from the perl check_cluster script " - "to create raw data for further analysis of cluster " - "distribution." - ); - addOption("h help", showSyntaxPage, false, - "Shows this help page"); - addOption("v verbose", verbose, false, - "Show verbose progress"); - addOption("c clusterstate", systemState, - "Cluster state to use for ideal state calculations"); - addOption("n numdisks", numDisks, - "The number of disks on each node"); - addOption("r redundancy", redundancy, 2.0, - "The redundancy used"); - addOption("d distribution", diskDistribution, 1, - "The disk distribution to use (0 = MODULO, 1 = " - "MODULO_INDEX, 2 = MODULO_KNUTH, 3 = MODULO_BID"); - addArgument("Test directory", testdir, std::string("."), - "The directory within to find gzipped file listings named " - "storage.*.shell.filelist.gz"); - } + Options(int argc, const char* const* argv); + ~Options(); }; +Options::Options(int argc, const char* const* argv) + : vespalib::ProgramOptions(argc, argv), + showSyntaxPage(false), + systemState(""), + numDisks(0), + diskDistribution(1), + redundancy(2.0) +{ + setSyntaxMessage("Analyzes distribution from a real cluster. " + "This tool reads gzipped files containing directory " + "listings from a live system and analyze how current " + "distribution and ideal distribution is in that cluster." + "The tool is typically run from the perl check_cluster script " + "to create raw data for further analysis of cluster " + "distribution." + ); + addOption("h help", showSyntaxPage, false, "Shows this help page"); + addOption("v verbose", verbose, false, "Show verbose progress"); + addOption("c clusterstate", systemState, "Cluster state to use for ideal state calculations"); + addOption("n numdisks", numDisks, "The number of disks on each node"); + addOption("r redundancy", redundancy, 2.0, "The redundancy used"); + addOption("d distribution", diskDistribution, 1, + "The disk distribution to use (0 = MODULO, 1 = MODULO_INDEX, 2 = MODULO_KNUTH, 3 = MODULO_BID"); + addArgument("Test directory", testdir, std::string("."), + "The directory within to find gzipped file listings named storage.*.shell.filelist.gz"); +} +Options::~Options() {} + + + struct Disk { struct Count { uint32_t bucketCount; @@ -111,16 +109,8 @@ struct Node { std::vector<Disk> disks; Disk::Count distributor; - Node(const lib::NodeState& dstate, const lib::NodeState& sstate, - uint32_t diskCount) - : distributorState(dstate), - storageState(sstate), - disks() - { - for (uint32_t i=0; i<diskCount; ++i) { - disks.push_back(Disk(storageState.getDiskState(i))); - } - } + Node(const lib::NodeState& dstate, const lib::NodeState& sstate, uint32_t diskCount); + ~Node(); void print(std::ostream& out, uint32_t nodeIndex) { if (distributorState.getState().oneOf("ui")) { @@ -134,6 +124,17 @@ struct Node { } }; +Node::Node(const lib::NodeState& dstate, const lib::NodeState& sstate, uint32_t diskCount) + : distributorState(dstate), + storageState(sstate), + disks() +{ + for (uint32_t i=0; i<diskCount; ++i) { + disks.push_back(Disk(storageState.getDiskState(i))); + } +} +Node::~Node() {} + struct Distribution { std::vector<Node> nodes; enum Type { INDEX, BID, TEST }; diff --git a/storage/src/vespa/storage/tools/generatedistributionbits.cpp b/storage/src/vespa/storage/tools/generatedistributionbits.cpp index 1acbc7e899c..53c7c7cf1a1 100644 --- a/storage/src/vespa/storage/tools/generatedistributionbits.cpp +++ b/storage/src/vespa/storage/tools/generatedistributionbits.cpp @@ -1,15 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include <vespa/document/bucket/bucketidfactory.h> #include <vespa/vespalib/util/programoptions.h> #include <vespa/vdslib/distribution/distribution.h> #include <vespa/vdslib/state/clusterstate.h> -#include <vespa/vdslib/state/nodestate.h> #include <vespa/storage/bucketdb/judyarray.h> -#include <stdio.h> #include <iomanip> #include <iostream> -#include <vespa/vespalib/util/programoptions.h> #include <vespa/config-stor-distribution.h> namespace storage { @@ -30,34 +26,8 @@ namespace storage { uint32_t skipNodeCountsBelow; uint32_t startAtNodeCount; - Options(int argc, const char* const* argv) - : vespalib::ProgramOptions(argc, argv) - { - setSyntaxMessage( - "Utility program for calculating skew of buckets stored on " - "storage nodes." - ); - addOption("r redundancy", redundancy, 2u, - "Number of copies stored on the nodes."); - addOption("b maxbit", maxBit, 32u, - "Maximum distribution bit count to calculate for."); - addOption("h hide", hideUtilizationAbove, 0.3, - "Hide utilizations worse than this."); - addOption("s skip", skipGood, false, - "Attempt to skip computations for node counts that " - "already have good distributions"); - addOption("highrange", highRange, false, - "Compute distribution for large systems instead of small " - "systems"); - addOption("html", printHtml, false, - "Print result as an HTML table"); - addOption("skipbitsbelow", skipBitsBelow, 0u, - "Skip calculating for bits below given value"); - addOption("skipnodecountsbelow", skipNodeCountsBelow, 0u, - "Skip calculating for node counts below given value"); - addOption("startatnodecount", startAtNodeCount, 0u, - "Start calculating for first bit at given node count"); - } + Options(int argc, const char* const* argv); + ~Options(); void finalize() { if (highRange) { @@ -118,6 +88,32 @@ namespace storage { } } + +Options::Options(int argc, const char* const* argv) + : vespalib::ProgramOptions(argc, argv) +{ + setSyntaxMessage("Utility program for calculating skew of buckets stored on storage nodes."); + addOption("r redundancy", redundancy, 2u, + "Number of copies stored on the nodes."); + addOption("b maxbit", maxBit, 32u, + "Maximum distribution bit count to calculate for."); + addOption("h hide", hideUtilizationAbove, 0.3, + "Hide utilizations worse than this."); + addOption("s skip", skipGood, false, + "Attempt to skip computations for node counts that already have good distributions"); + addOption("highrange", highRange, false, + "Compute distribution for large systems instead of small systems"); + addOption("html", printHtml, false, + "Print result as an HTML table"); + addOption("skipbitsbelow", skipBitsBelow, 0u, + "Skip calculating for bits below given value"); + addOption("skipnodecountsbelow", skipNodeCountsBelow, 0u, + "Skip calculating for node counts below given value"); + addOption("startatnodecount", startAtNodeCount, 0u, + "Start calculating for first bit at given node count"); +} +Options::~Options() {} + } // storage int main(int argc, char** argv) { diff --git a/storage/src/vespa/storage/tools/getidealstate.cpp b/storage/src/vespa/storage/tools/getidealstate.cpp index c3c7a4ba480..e221ce686e4 100644 --- a/storage/src/vespa/storage/tools/getidealstate.cpp +++ b/storage/src/vespa/storage/tools/getidealstate.cpp @@ -25,42 +25,8 @@ struct Options : public vespalib::ProgramOptions { bool bucketsOnStdIn; bool verbose; - Options(int argc, const char* const* argv) - : vespalib::ProgramOptions(argc, argv) - { - setSyntaxMessage( - "Utility program for calculating the ideal state of " - "buckets. Useful to verify correctness of distribution " - "operations." - ); - addOption("h help", showSyntaxPage, false, - "Shows this help page"); - addOption("s clusterstate", clusterState, std::string(""), - "The state of the cluster to calculate position in"); - addOption("n diskcount", diskCount, uint32_t(0), - "The number of disks on each node"); - addOption("r redundancy", redundancy, uint32_t(2), - "The redundancy to keep for each bucket"); - addOption("diskdistribution", diskDistribution, - std::string("MODULO_BID"), - "Disk distribution algorithm used"); - addOption("u upstates", upStates, std::string("uims"), - "States to consider as up in ideal state calculations"); - addOption("i stdin", bucketsOnStdIn, false, - "Read stdin to get buckets to calculate ideal position for"); - addOption("v verbose", verbose, false, - "Print extra information while running"); - addArgument("bucket", bucket, std::string(""), - "Bucket for which to calculate ideal state"); - - addOptionHeader( - "By default, it will be assumed that all nodes are in one top " - "group, and no config will be read to calculate bucket " - "positions. If a cluster name is specified, config will be " - "read to get group hierarchy correctly for cluster."); - addOption("c clustername", clusterName, std::string(""), - "Name of the cluster to get config from"); - } + Options(int argc, const char* const* argv); + ~Options(); bool useConfig() const { return !clusterName.empty(); } @@ -71,6 +37,39 @@ struct Options : public vespalib::ProgramOptions { } }; +Options::Options(int argc, const char* const* argv) + : vespalib::ProgramOptions(argc, argv) +{ + setSyntaxMessage("Utility program for calculating the ideal state of buckets." + " Useful to verify correctness of distribution operations."); + addOption("h help", showSyntaxPage, false, + "Shows this help page"); + addOption("s clusterstate", clusterState, std::string(""), + "The state of the cluster to calculate position in"); + addOption("n diskcount", diskCount, uint32_t(0), + "The number of disks on each node"); + addOption("r redundancy", redundancy, uint32_t(2), + "The redundancy to keep for each bucket"); + addOption("diskdistribution", diskDistribution, std::string("MODULO_BID"), + "Disk distribution algorithm used"); + addOption("u upstates", upStates, std::string("uims"), + "States to consider as up in ideal state calculations"); + addOption("i stdin", bucketsOnStdIn, false, + "Read stdin to get buckets to calculate ideal position for"); + addOption("v verbose", verbose, false, + "Print extra information while running"); + addArgument("bucket", bucket, std::string(""), + "Bucket for which to calculate ideal state"); + addOptionHeader("By default, it will be assumed that all nodes are in one top " + "group, and no config will be read to calculate bucket " + "positions. If a cluster name is specified, config will be " + "read to get group hierarchy correctly for cluster."); + addOption("c clustername", clusterName, std::string(""), + "Name of the cluster to get config from"); +} +Options::~Options() {} + + void processBucket(const lib::Distribution& distribution, const lib::ClusterState& clusterState, const std::string& upStates, diff --git a/storage/src/vespa/storage/tools/statfs.cpp b/storage/src/vespa/storage/tools/statfs.cpp index d23a3037a7a..29cedc97bbc 100644 --- a/storage/src/vespa/storage/tools/statfs.cpp +++ b/storage/src/vespa/storage/tools/statfs.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <errno.h> #include <iostream> #include <sys/vfs.h> #include <vespa/vespalib/util/programoptions.h> @@ -11,18 +9,23 @@ struct Options : public vespalib::ProgramOptions { bool showSyntaxPage; std::string _filename; - Options(int argc, const char* const* argv) - : vespalib::ProgramOptions(argc, argv), - showSyntaxPage(false) - { - setSyntaxMessage( - "Utility program for checking output of statfs." - ); - addOption("h help", showSyntaxPage, false, - "Shows this help page"); - addArgument("file", _filename, "File to use when calling statfs()"); - } - }; + Options(int argc, const char* const* argv); + ~Options(); +}; + +Options::Options(int argc, const char* const* argv) + : vespalib::ProgramOptions(argc, argv), + showSyntaxPage(false) +{ + setSyntaxMessage( + "Utility program for checking output of statfs." + ); + addOption("h help", showSyntaxPage, false, + "Shows this help page"); + addArgument("file", _filename, "File to use when calling statfs()"); +} +Options::~Options() {} + int main(int argc, char** argv) { Options o(argc, argv); diff --git a/storage/src/vespa/storage/tools/throttlingsim.h b/storage/src/vespa/storage/tools/throttlingsim.h index 765b007ab99..9135507c0d3 100644 --- a/storage/src/vespa/storage/tools/throttlingsim.h +++ b/storage/src/vespa/storage/tools/throttlingsim.h @@ -50,13 +50,17 @@ public: int lastOk; int meanwaitms; - Messaging(int meanwait) : lastOk(0), meanwaitms(meanwait) {}; + Messaging(int meanwait); + ~Messaging(); void sendMessage(const Message& m); void print(); void run(); }; +Messaging::Messaging(int meanwait) : lastOk(0), meanwaitms(meanwait) {} +Messaging::~Messaging() {} + class Client : public document::Runnable { public: vespalib::Monitor sync; @@ -74,10 +78,14 @@ public: virtual void run(); virtual void print(double timenow); - Client(Messaging& msgng, double windowSize, int to) : - ok(0), failed(0), busy(0), pending(0), windowsize(windowSize), messaging(msgng), timeout(to), max_diff(0) {} + Client(Messaging& msgng, double windowSize, int to); + ~Client(); }; +Client::Client(Messaging& msgng, double windowSize, int to) + : ok(0), failed(0), busy(0), pending(0), windowsize(windowSize), messaging(msgng), timeout(to), max_diff(0) +{} +Client::~Client() {} class FixedClient : public Client { public: |