diff options
author | Jochen Topf <jochen@topf.org> | 2014-05-15 11:01:43 +0200 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2014-05-15 15:06:22 +0200 |
commit | 13dc9ce483faecb945000ae8d8510a962cce93c3 (patch) | |
tree | 9f2bdfac9ee1fa6e3f0cefaa6875d9d768c4a47b /tagstats | |
parent | 232a356246a1f681e59c82eaee259c2d25aa6825 (diff) | |
download | taginfo-13dc9ce483faecb945000ae8d8510a962cce93c3.tar taginfo-13dc9ce483faecb945000ae8d8510a962cce93c3.tar.gz |
Make output while tagstats is running easier to read.
Diffstat (limited to 'tagstats')
-rw-r--r-- | tagstats/tagstats.cpp | 3 | ||||
-rw-r--r-- | tagstats/tagstats_handler.hpp | 47 |
2 files changed, 29 insertions, 21 deletions
diff --git a/tagstats/tagstats.cpp b/tagstats/tagstats.cpp index 028381a..f5c349a 100644 --- a/tagstats/tagstats.cpp +++ b/tagstats/tagstats.cpp @@ -49,9 +49,6 @@ int GeoDistribution::c_height; #include "tagstats_handler.hpp" - -/* ================================================== */ - void print_help() { std::cout << "tagstats [OPTIONS] OSMFILE DATABASE\n\n" \ << "This program is part of taginfo. It calculates statistics on OSM tags\n" \ diff --git a/tagstats/tagstats_handler.hpp b/tagstats/tagstats_handler.hpp index f5077aa..fd417cb 100644 --- a/tagstats/tagstats_handler.hpp +++ b/tagstats/tagstats_handler.hpp @@ -264,7 +264,7 @@ class TagStatsHandler : public Osmium::Handler::Base { void _timer_info(const char *msg) { int duration = time(0) - timer; - std::cerr << msg << " took " << duration << " seconds (about " << duration / 60 << " minutes)" << std::endl; + std::cerr << " " << msg << " took " << duration << " seconds (about " << duration / 60 << " minutes)\n\n"; } void _update_key_combination_hash(const Osmium::OSM::Object& object) { @@ -558,6 +558,8 @@ public: } void before_nodes() { + std::cerr << "------------------------------------------------------------------------------\n"; + std::cerr << "Processing nodes...\n"; timer = time(0); } @@ -584,6 +586,8 @@ public: } void before_ways() { + std::cerr << "------------------------------------------------------------------------------\n"; + std::cerr << "Processing ways...\n"; timer = time(0); } @@ -597,14 +601,19 @@ public: } void before_relations() { + std::cerr << "------------------------------------------------------------------------------\n"; + std::cerr << "Processing relations...\n"; timer = time(0); } void after_relations() { _timer_info("processing relations"); + _print_memory_usage(); } void init(Osmium::OSM::Meta&) { + std::cerr << "------------------------------------------------------------------------------\n"; + std::cerr << "Starting tagstats...\n\n"; std::cerr << "Sizes of some important data structures:\n"; std::cerr << " sizeof(value_hash_map_t) = " << sizeof(value_hash_map_t) << "\n"; std::cerr << " sizeof(Counter) = " << sizeof(Counter) << "\n"; @@ -614,13 +623,13 @@ public: std::cerr << " sizeof(KeyStats) = " << sizeof(KeyStats) << "\n\n"; _print_memory_usage(); - std::cerr << "init done" << std::endl << std::endl; } void final() { - statistics_handler.final(); - _print_memory_usage(); + std::cerr << "------------------------------------------------------------------------------\n"; + std::cerr << "Writing results to database...\n"; timer = time(0); + statistics_handler.final(); Sqlite::Statement statement_insert_into_keys(m_database, "INSERT INTO keys (key, " \ " count_all, count_nodes, count_ways, count_relations, " \ @@ -782,33 +791,35 @@ public: m_database.commit(); - _timer_info("dumping to db"); + _timer_info("writing results to database"); - std::cerr << std::endl << "hash map sizes:" << std::endl; - std::cerr << " tags: size=" << tags_hash_size << " buckets=" << tags_hash_buckets << " sizeof(KeyStats)=" << sizeof(KeyStats) << " *=" << tags_hash_size * sizeof(KeyStats) << std::endl; - std::cerr << " values: size=" << values_hash_size << " buckets=" << values_hash_buckets << " sizeof(Counter)=" << sizeof(Counter) << " *=" << values_hash_size * sizeof(Counter) << std::endl; - std::cerr << " key combinations: size=" << key_combination_hash_size << " buckets=" << key_combination_hash_buckets << " sizeof(Counter)=" << sizeof(Counter) << " *=" << key_combination_hash_size * sizeof(Counter) << std::endl; - std::cerr << " users: size=" << user_hash_size << " buckets=" << user_hash_buckets << " sizeof(uint32_t)=" << sizeof(uint32_t) << " *=" << user_hash_size * sizeof(uint32_t) << std::endl; + std::cerr << "hash map sizes:\n"; + std::cerr << " tags: size=" << tags_hash_size << " buckets=" << tags_hash_buckets << " sizeof(KeyStats)=" << sizeof(KeyStats) << " *=" << tags_hash_size * sizeof(KeyStats) << "\n"; + std::cerr << " values: size=" << values_hash_size << " buckets=" << values_hash_buckets << " sizeof(Counter)=" << sizeof(Counter) << " *=" << values_hash_size * sizeof(Counter) << "\n"; + std::cerr << " key combinations: size=" << key_combination_hash_size << " buckets=" << key_combination_hash_buckets << " sizeof(Counter)=" << sizeof(Counter) << " *=" << key_combination_hash_size * sizeof(Counter) << "\n"; + std::cerr << " users: size=" << user_hash_size << " buckets=" << user_hash_buckets << " sizeof(uint32_t)=" << sizeof(uint32_t) << " *=" << user_hash_size * sizeof(uint32_t) << "\n"; std::cerr << " sum: " << tags_hash_size * sizeof(KeyStats) + values_hash_size * sizeof(Counter) + key_combination_hash_size * sizeof(Counter) + user_hash_size * sizeof(uint32_t) - << std::endl; + << "\n"; - std::cerr << std::endl << "total memory for hashes:" << std::endl; - std::cerr << " (sizeof(hash key) + sizeof(hash value *) + 2.5 bit overhead) * bucket_count + sizeof(hash value) * size" << std::endl; - std::cerr << " tags: " << ((sizeof(const char*)*8 + sizeof(KeyStats *)*8 + 3) * tags_hash_buckets / 8 ) + sizeof(KeyStats) * tags_hash_size << std::endl; - std::cerr << " (sizeof(hash key) + sizeof(hash value ) + 2.5 bit overhead) * bucket_count" << std::endl; - std::cerr << " values: " << ((sizeof(const char*)*8 + sizeof(Counter)*8 + 3) * values_hash_buckets / 8 ) << std::endl; - std::cerr << " key combinations: " << ((sizeof(const char*)*8 + sizeof(Counter)*8 + 3) * key_combination_hash_buckets / 8 ) << std::endl; + std::cerr << "\n" << "total memory for hashes:" << "\n"; + std::cerr << " (sizeof(hash key) + sizeof(hash value *) + 2.5 bit overhead) * bucket_count + sizeof(hash value) * size\n"; + std::cerr << " tags: " << ((sizeof(const char*)*8 + sizeof(KeyStats *)*8 + 3) * tags_hash_buckets / 8 ) + sizeof(KeyStats) * tags_hash_size << "\n"; + std::cerr << " (sizeof(hash key) + sizeof(hash value ) + 2.5 bit overhead) * bucket_count\n"; + std::cerr << " values: " << ((sizeof(const char*)*8 + sizeof(Counter)*8 + 3) * values_hash_buckets / 8 ) << "\n"; + std::cerr << " key combinations: " << ((sizeof(const char*)*8 + sizeof(Counter)*8 + 3) * key_combination_hash_buckets / 8 ) << "\n"; - std::cerr << " users: " << ((sizeof(osm_user_id_t)*8 + sizeof(uint32_t)*8 + 3) * user_hash_buckets / 8 ) << std::endl; + std::cerr << " users: " << ((sizeof(osm_user_id_t)*8 + sizeof(uint32_t)*8 + 3) * user_hash_buckets / 8 ) << "\n"; std::cerr << std::endl; _print_memory_usage(); + + std::cerr << "------------------------------------------------------------------------------\n"; } }; // class TagStatsHandler |