add natvis file

This commit is contained in:
greg
2019-06-15 19:50:43 -04:00
parent 83ee317c07
commit 58816906b4
3 changed files with 137 additions and 15 deletions
+10 -9
View File
@@ -114,20 +114,21 @@ endif()
if (PHMAP_BUILD_EXAMPLES)
if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-include-dirs -Woverloaded-virtual -Wredundant-decls -Wshadow -Wstrict-null-sentinel -Wswitch-default -Wno-unused")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wdisabled-optimization -Wformat=12 -Winit-self -Wlogical-op -Wmissing-include-dirs -Woverloaded-virtual -Wredundant-decls -Wshadow -Wstrict-null-sentinel -Wswitch-default -Wno-unused")
endif()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
add_executable(ex_basic examples/basic.cc)
add_executable(ex_bench examples/bench.cc)
add_executable(ex_emplace examples/emplace.cc)
add_executable(ex_hash_std examples/hash_std.cc)
add_executable(ex_hash_value examples/hash_value.cc)
add_executable(ex_two_files examples/f1.cc examples/f2.cc)
add_executable(ex_insert_bench examples/insert_bench.cc)
add_executable(ex_knucleotide examples/knucleotide.cc)
add_executable(ex_allmaps examples/allmaps.cc phmap.natvis)
add_executable(ex_basic examples/basic.cc phmap.natvis)
add_executable(ex_bench examples/bench.cc phmap.natvis)
add_executable(ex_emplace examples/emplace.cc phmap.natvis)
add_executable(ex_hash_std examples/hash_std.cc phmap.natvis)
add_executable(ex_hash_value examples/hash_value.cc phmap.natvis)
add_executable(ex_two_files examples/f1.cc examples/f2.cc phmap.natvis)
add_executable(ex_insert_bench examples/insert_bench.cc phmap.natvis)
add_executable(ex_knucleotide examples/knucleotide.cc phmap.natvis)
target_link_libraries(ex_knucleotide Threads::Threads)
target_link_libraries(ex_bench Threads::Threads)
endif()
+59
View File
@@ -0,0 +1,59 @@
// Silly program just to test the natvis file for Visual Studio
// ------------------------------------------------------------
#include <string>
#include "parallel_hashmap/phmap.h"
template<class Set, class F>
void test_set(F &f)
{
Set s;
Set::iterator it;
for (int i=0; i<100; ++i)
s.insert(f(i));
it = s.begin();
++it;
it = s.end();
it = s.begin();
while(it != s.end())
++it;
it = s.begin();
}
int main(int argc, char ** argv)
{
using namespace std;
auto make_int = [](int i) { return i; };
auto make_string = [](int i) { return std::to_string(i); };
auto make_2int = [](int i) { return std::make_pair(i, i); };
auto make_2string = [](int i) { return std::make_pair(std::to_string(i), std::to_string(i)); };
test_set<phmap::flat_hash_set<int>>(make_int);
test_set<phmap::flat_hash_set<string>>(make_string);
test_set<phmap::node_hash_set<int>>(make_int);
test_set<phmap::node_hash_set<string>>(make_string);
test_set<phmap::flat_hash_map<int, int>>(make_2int);
test_set<phmap::flat_hash_map<string, string>>(make_2string);
test_set<phmap::node_hash_map<int, int>>(make_2int);
test_set<phmap::node_hash_map<string, string>>(make_2string);
test_set<phmap::parallel_flat_hash_set<int>>(make_int);
test_set<phmap::parallel_flat_hash_set<string>>(make_string);
test_set<phmap::parallel_node_hash_set<int>>(make_int);
test_set<phmap::parallel_node_hash_set<string>>(make_string);
test_set<phmap::parallel_flat_hash_map<int, int>>(make_2int);
test_set<phmap::parallel_flat_hash_map<string, string>>(make_2string);
test_set<phmap::parallel_node_hash_map<int, int>>(make_2int);
test_set<phmap::parallel_node_hash_map<string, string>>(make_2string);
}
+68 -6
View File
@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<!-- VC 2015 -->
<!-- flat map/set -->
<Type Name="phmap::flat_hash_set&lt;*,*,*,*&gt;">
<AlternativeType Name="phmap::flat_hash_map&lt;*,*,*,*,*&gt;" />
<AlternativeType Name="phmap::node_hash_set&lt;*,*,*,*&gt;" />
<AlternativeType Name="phmap::node_hash_map&lt;*,*,*,*,*&gt;" />
<DisplayString>{{size = {size_}}}</DisplayString>
<Expand>
<CustomListItems MaxItemsPerView="1000" ExcludeView="Test">
@@ -26,21 +24,52 @@
</CustomListItems>
</Expand>
</Type>
<!-- node map/set - only difference is the **slot instead of *slot -->
<Type Name="phmap::node_hash_set&lt;*,*,*,*&gt;">
<AlternativeType Name="phmap::node_hash_map&lt;*,*,*,*,*&gt;" />
<DisplayString>{{size = {size_}}}</DisplayString>
<Expand>
<CustomListItems MaxItemsPerView="1000" ExcludeView="Test">
<Variable Name="ctrl" InitialValue="ctrl_" />
<Variable Name="slot" InitialValue="slots_" />
<Variable Name="ctrl_end" InitialValue="ctrl_ + capacity_" />
<Variable Name="slot_end" InitialValue="slots_ + capacity_" />
<Size>size_</Size>
<Loop>
<Break Condition="slot == slot_end" />
<If Condition="*ctrl >= -1">
<Item>**slot,na</Item>
</If>
<Exec>++slot</Exec>
<Exec>++ctrl</Exec>
</Loop>
</CustomListItems>
</Expand>
</Type>
<Type Name="phmap::container_internal::map_slot_type&lt;*,*&gt;">
<DisplayString>{value}</DisplayString>
</Type>
<!-- flat map iterators -->
<Type Name="phmap::container_internal::raw_hash_set&lt;*,*,*,*&gt;::iterator">
<DisplayString Condition="ctrl_ == 0">unset</DisplayString>
<DisplayString Condition="!(*ctrl_ >= 0)">end()</DisplayString>
<DisplayString>{*slot_,na}</DisplayString>
</Type>
<!-- node map iterators - only difference is the **slot_ instead of * -->
<Type Name="phmap::container_internal::raw_hash_set&lt;phmap::container_internal::NodeHashSetPolicy&lt;*&gt;,*,*,*&gt;::iterator">
<DisplayString Condition="ctrl_ == 0">unset</DisplayString>
<DisplayString Condition="!(*ctrl_ >= 0)">end()</DisplayString>
<DisplayString>{**slot_,na}</DisplayString>
</Type>
<!-- parallel flat/node set -->
<Type Name="phmap::parallel_flat_hash_set&lt;*,*,*,*,*,*&gt;">
<AlternativeType Name="phmap::parallel_flat_hash_map&lt;*,*,*,*,*,*,*&gt;" />
<AlternativeType Name="phmap::parallel_node_hash_set&lt;*,*,*,*,*,*&gt;" />
<AlternativeType Name="phmap::parallel_node_hash_map&lt;*,*,*,*,*,*,*&gt;" />
<DisplayString>{{size = ?}}</DisplayString>
<Expand>
<CustomListItems MaxItemsPerView="1000" ExcludeView="Test">
@@ -70,7 +99,40 @@
</CustomListItems>
</Expand>
</Type>
<!-- parallel flat/node map - only difference is $T6 instead of $T5 -->
<Type Name="phmap::parallel_flat_hash_map&lt;*,*,*,*,*,*,*&gt;">
<AlternativeType Name="phmap::parallel_node_hash_map&lt;*,*,*,*,*,*,*&gt;" />
<DisplayString>{{size = ?}}</DisplayString>
<Expand>
<CustomListItems MaxItemsPerView="1000" ExcludeView="Test">
<Variable Name="idx" InitialValue="0" />
<Variable Name="maxidx" InitialValue="$T6" />
<Variable Name="ctrl" InitialValue="sets_._Elems[0].set_.ctrl_" />
<Variable Name="slot" InitialValue="sets_._Elems[0].set_.slots_" />
<Variable Name="ctrl_end" InitialValue="sets_._Elems[0].set_.ctrl_" />
<Variable Name="slot_end" InitialValue="sets_._Elems[0].set_.slots_" />
<Exec>maxidx = 2 &lt;&lt; maxidx</Exec>
<Loop>
<Break Condition="idx == maxidx" />
<Exec>ctrl = sets_._Elems[idx].set_.ctrl_</Exec>
<Exec>slot = sets_._Elems[idx].set_.slots_</Exec>
<Exec>ctrl_end = sets_._Elems[idx].set_.ctrl_ + sets_._Elems[idx].set_.capacity_</Exec>
<Exec>slot_end = sets_._Elems[idx].set_.slots_ + sets_._Elems[idx].set_.capacity_</Exec>
<Loop>
<Break Condition="slot == slot_end" />
<If Condition="*ctrl >= -1">
<Item>*slot,na</Item>
</If>
<Exec>++slot</Exec>
<Exec>++ctrl</Exec>
</Loop>
<Exec>++idx</Exec>
</Loop>
</CustomListItems>
</Expand>
</Type>
<Type Name="phmap::container_internal::parallel_hash_set&lt;*,*,*,*,*,*,*&gt;::iterator">
<DisplayString>{it_,na}</DisplayString>
</Type>