From db494f4239b4fc2ed0aba1b276006d67606f8498 Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Wed, 12 May 2021 10:56:21 +0200 Subject: [PATCH] more Timers in Mesh --- libsrc/core/table.hpp | 4 ++++ libsrc/meshing/clusters.cpp | 8 ++++---- libsrc/meshing/meshclass.cpp | 8 ++++++++ libsrc/meshing/topology.cpp | 11 +++++++---- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/libsrc/core/table.hpp b/libsrc/core/table.hpp index 2e6d37d6..6a851605 100644 --- a/libsrc/core/table.hpp +++ b/libsrc/core/table.hpp @@ -351,6 +351,8 @@ namespace ngcore template Table CreateTable( const TRange & range, const TFunc & func, std::optional< size_t > cnt ) { + static Timer timer("CreateTable"); + RegionTimer rt(timer); std::unique_ptr> pcreator; if(cnt) @@ -375,6 +377,8 @@ namespace ngcore template Table CreateSortedTable( const TRange & range, const TFunc & func, std::optional< size_t > cnt ) { + static Timer timer("CreateSortedTable"); + RegionTimer rt(timer); Table table = CreateTable(range, func, cnt); ParallelForRange (table.Range(), [&] (auto myrange) diff --git a/libsrc/meshing/clusters.cpp b/libsrc/meshing/clusters.cpp index dae820df..c01d1db3 100644 --- a/libsrc/meshing/clusters.cpp +++ b/libsrc/meshing/clusters.cpp @@ -18,11 +18,11 @@ namespace netgen void AnisotropicClusters :: Update(NgTaskManager tm, NgTracer tracer) { - static int timer = NgProfiler::CreateTimer ("clusters"); + static Timer timer("clusters"); // static int timer1 = NgProfiler::CreateTimer ("clusters1"); // static int timer2 = NgProfiler::CreateTimer ("clusters2"); // static int timer3 = NgProfiler::CreateTimer ("clusters3"); - NgProfiler::RegionTimer reg (timer); + RegionTimer reg (timer); const MeshTopology & top = mesh.GetTopology(); @@ -215,7 +215,8 @@ namespace netgen do { - (*tracer) ("update cluster, identify", false); + static Timer t("update cluster, identify"); + RegionTimer rtr(t); cnt++; changed = 0; @@ -338,7 +339,6 @@ namespace netgen } */ } - (*tracer) ("update cluster, identify", true); } while (changed); // NgProfiler::StopTimer(timer3); diff --git a/libsrc/meshing/meshclass.cpp b/libsrc/meshing/meshclass.cpp index d9fc8fb7..1d325d8a 100644 --- a/libsrc/meshing/meshclass.cpp +++ b/libsrc/meshing/meshclass.cpp @@ -916,6 +916,7 @@ namespace netgen void Mesh :: Load (istream & infile) { + static Timer timer("Mesh::Load"); RegionTimer rt(timer); if (! (infile.good()) ) { cout << "cannot load mesh" << endl; @@ -956,6 +957,7 @@ namespace netgen if (strcmp (str, "surfaceelements") == 0 || strcmp (str, "surfaceelementsgi")==0 || strcmp (str, "surfaceelementsuv") == 0) { + static Timer t1("read surface elements"); RegionTimer rt1(t1); infile >> n; PrintMessage (3, n, " surface elements"); @@ -1020,6 +1022,7 @@ namespace netgen if (strcmp (str, "volumeelements") == 0) { + static Timer t1("read volume elements"); RegionTimer rt1(t1); infile >> n; PrintMessage (3, n, " volume elements"); for (i = 1; i <= n; i++) @@ -1045,6 +1048,7 @@ namespace netgen if (strcmp (str, "edgesegments") == 0) { + static Timer t1("read edge segments"); RegionTimer rt1(t1); infile >> n; for (i = 1; i <= n; i++) { @@ -1059,6 +1063,7 @@ namespace netgen if (strcmp (str, "edgesegmentsgi") == 0) { + static Timer t1("read edge segmentsgi"); RegionTimer rt1(t1); infile >> n; for (i = 1; i <= n; i++) { @@ -1073,6 +1078,7 @@ namespace netgen if (strcmp (str, "edgesegmentsgi2") == 0) { + static Timer t1("read edge segmentsgi2"); RegionTimer rt1(t1); int a; infile >> a; n=a; @@ -1106,6 +1112,7 @@ namespace netgen if (strcmp (str, "points") == 0) { + static Timer t1("read points"); RegionTimer rt1(t1); infile >> n; PrintMessage (3, n, " points"); for (i = 1; i <= n; i++) @@ -1122,6 +1129,7 @@ namespace netgen if (strcmp (str, "pointelements") == 0) { + static Timer t1("read point elements"); RegionTimer rt1(t1); infile >> n; PrintMessage (3, n, " pointelements"); for (i = 1; i <= n; i++) diff --git a/libsrc/meshing/topology.cpp b/libsrc/meshing/topology.cpp index 5de13b40..95122a11 100644 --- a/libsrc/meshing/topology.cpp +++ b/libsrc/meshing/topology.cpp @@ -368,6 +368,7 @@ namespace netgen void MeshTopology :: Update (NgTaskManager tm_unused, NgTracer tracer) { static Timer timer("Topology::Update"); + static Timer timer_tables("Build vertex to element table"); RegionTimer reg (timer); #ifdef PARALLEL @@ -406,6 +407,7 @@ namespace netgen vertex to segment */ + timer_tables.Start(); vert2element = mesh->CreatePoint2ElementTable(); vert2surfelement = mesh->CreatePoint2SurfaceElementTable(0); @@ -423,6 +425,7 @@ namespace netgen const Element0d & pointel = mesh->pointelements[pei]; table.Add(pointel.pnum, pei); }, np); + timer_tables.Stop(); (*tracer) ("Topology::Update setup tables", true); @@ -430,8 +433,8 @@ namespace netgen if (buildedges) { - static int timer1 = NgProfiler::CreateTimer ("topology::buildedges"); - NgProfiler::RegionTimer reg1 (timer1); + static Timer timer1("topology::buildedges"); + RegionTimer reg1(timer1); if (id == 0) PrintMessage (5, "Update edges "); @@ -894,12 +897,12 @@ namespace netgen // generate faces if (buildfaces) { - static int timer2 = NgProfiler::CreateTimer ("topology::buildfaces"); + static Timer timer2("topology::buildfaces"); // static int timer2a = NgProfiler::CreateTimer ("topology::buildfacesa"); // static int timer2b = NgProfiler::CreateTimer ("topology::buildfacesb"); // static int timer2b1 = NgProfiler::CreateTimer ("topology::buildfacesb1"); // static int timer2c = NgProfiler::CreateTimer ("topology::buildfacesc"); - NgProfiler::RegionTimer reg2 (timer2); + RegionTimer reg2 (timer2); if (id == 0) PrintMessage (5, "Update faces ");