From 83d0813b0ffc8f329a214b533467c761d734e0c1 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 12 Jan 2015 13:45:44 +0000 Subject: [PATCH] Yet more tracking --- src/client.hh | 2 +- src/command_manager.hh | 4 ++-- src/commands.cc | 9 ++++++++- src/hook_manager.hh | 2 +- src/keymap_manager.hh | 7 +++---- src/keys.hh | 5 ++--- src/memory.hh | 3 +++ src/parameters_parser.hh | 6 +++--- src/unit_tests.cc | 2 +- 9 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/client.hh b/src/client.hh index 6beb61f4..3a614314 100644 --- a/src/client.hh +++ b/src/client.hh @@ -70,7 +70,7 @@ private: DisplayLine m_pending_status_line; DisplayLine m_mode_line; - std::vector m_pending_keys; + Vector m_pending_keys; }; } diff --git a/src/command_manager.hh b/src/command_manager.hh index f6118781..75b15567 100644 --- a/src/command_manager.hh +++ b/src/command_manager.hh @@ -50,7 +50,7 @@ public: ByteCount pos_in_token) const; private: - std::vector m_completers; + Vector m_completers; }; using CommandInfo = std::pair; @@ -88,7 +88,7 @@ private: CommandFlags flags; CommandCompleter completer; }; - using CommandMap = UnorderedMap; + using CommandMap = UnorderedMap; CommandMap m_commands; CommandMap::const_iterator find_command(const Context& context, diff --git a/src/commands.cc b/src/commands.cc index 2b930826..c2753fca 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -833,9 +833,13 @@ const CommandDesc debug_cmd = { auto options = UsedMemory::byte_count; auto highlight = UsedMemory::byte_count; auto word_db = UsedMemory::byte_count; + auto mapping = UsedMemory::byte_count; + auto commands = UsedMemory::byte_count; + auto hooks = UsedMemory::byte_count; auto undefined = UsedMemory::byte_count; - auto total = string + interned_string + buffer_content + buffer_meta + options + highlight + word_db + undefined; + auto total = string + interned_string + buffer_content + buffer_meta + + options + highlight + word_db + mapping + commands + hooks + undefined; write_debug("Memory usage:"); write_debug("String: " + to_string(string)); @@ -845,6 +849,9 @@ const CommandDesc debug_cmd = { write_debug("Options: " + to_string(options)); write_debug("Highlight: " + to_string(highlight)); write_debug("WordDB: " + to_string(word_db)); + write_debug("Mapping: " + to_string(mapping)); + write_debug("Commands: " + to_string(commands)); + write_debug("Hooks: " + to_string(hooks)); write_debug("Undefined: " + to_string(undefined)); write_debug("Total: " + to_string(total)); write_debug("Malloced: " + to_string(mallinfo().uordblks)); diff --git a/src/hook_manager.hh b/src/hook_manager.hh index 5fe0a6be..410afd61 100644 --- a/src/hook_manager.hh +++ b/src/hook_manager.hh @@ -29,7 +29,7 @@ private: friend class Scope; HookManager* m_parent; - UnorderedMap> m_hook; + UnorderedMap, MemoryDomain::Hooks> m_hook; }; } diff --git a/src/keymap_manager.hh b/src/keymap_manager.hh index 8387e1ef..dd05c176 100644 --- a/src/keymap_manager.hh +++ b/src/keymap_manager.hh @@ -4,8 +4,7 @@ #include "keys.hh" #include "hash.hh" #include "unordered_map.hh" - -#include +#include "vector.hh" namespace Kakoune { @@ -29,7 +28,7 @@ class KeymapManager public: KeymapManager(KeymapManager& parent) : m_parent(&parent) {} - using KeyList = std::vector; + using KeyList = Vector; void map_key(Key key, KeymapMode mode, KeyList mapping); void unmap_key(Key key, KeymapMode mode); @@ -44,7 +43,7 @@ private: KeymapManager* m_parent; using KeyAndMode = std::pair; - using Keymap = UnorderedMap; + using Keymap = UnorderedMap; Keymap m_mapping; }; diff --git a/src/keys.hh b/src/keys.hh index 92ae0f70..f754ce68 100644 --- a/src/keys.hh +++ b/src/keys.hh @@ -4,8 +4,7 @@ #include "unicode.hh" #include "flags.hh" #include "hash.hh" - -#include +#include "vector.hh" namespace Kakoune { @@ -67,7 +66,7 @@ struct Key template<> struct WithBitOps : std::true_type {}; -using KeyList = std::vector; +using KeyList = Vector; class String; class StringView; diff --git a/src/memory.hh b/src/memory.hh index 4d2d446f..670da739 100644 --- a/src/memory.hh +++ b/src/memory.hh @@ -17,6 +17,9 @@ enum class MemoryDomain BufferMeta, Options, Highlight, + Mapping, + Commands, + Hooks, WordDB }; diff --git a/src/parameters_parser.hh b/src/parameters_parser.hh index cf60e892..fc8867d0 100644 --- a/src/parameters_parser.hh +++ b/src/parameters_parser.hh @@ -40,7 +40,7 @@ struct SwitchDesc String description; }; -using SwitchMap = IdMap; +using SwitchMap = IdMap; String generate_switches_doc(const SwitchMap& opts); @@ -145,8 +145,8 @@ struct ParametersParser iterator end() const; private: - ParameterList m_params; - std::vector m_positional_indices; + ParameterList m_params; + Vector m_positional_indices; const ParameterDesc& m_desc; }; diff --git a/src/unit_tests.cc b/src/unit_tests.cc index d4a78784..007922b4 100644 --- a/src/unit_tests.cc +++ b/src/unit_tests.cc @@ -138,7 +138,7 @@ void test_string() void test_keys() { - std::vector keys{ + KeyList keys{ { ' ' }, { 'c' }, { Key::Modifiers::Alt, 'j' },