more Timers in Mesh

This commit is contained in:
Matthias Hochsteger 2021-05-12 10:56:21 +02:00
parent 5bba076c9e
commit db494f4239
4 changed files with 23 additions and 8 deletions

View File

@ -351,6 +351,8 @@ namespace ngcore
template <typename TEntry, typename TIndex, typename TRange, typename TFunc> template <typename TEntry, typename TIndex, typename TRange, typename TFunc>
Table<TEntry, TIndex> CreateTable( const TRange & range, const TFunc & func, std::optional< size_t > cnt ) Table<TEntry, TIndex> CreateTable( const TRange & range, const TFunc & func, std::optional< size_t > cnt )
{ {
static Timer timer("CreateTable");
RegionTimer rt(timer);
std::unique_ptr<TableCreator<TEntry, TIndex>> pcreator; std::unique_ptr<TableCreator<TEntry, TIndex>> pcreator;
if(cnt) if(cnt)
@ -375,6 +377,8 @@ namespace ngcore
template <typename TEntry, typename TIndex, typename TRange, typename TFunc> template <typename TEntry, typename TIndex, typename TRange, typename TFunc>
Table<TEntry, TIndex> CreateSortedTable( const TRange & range, const TFunc & func, std::optional< size_t > cnt ) Table<TEntry, TIndex> CreateSortedTable( const TRange & range, const TFunc & func, std::optional< size_t > cnt )
{ {
static Timer timer("CreateSortedTable");
RegionTimer rt(timer);
Table<TEntry, TIndex> table = CreateTable<TEntry, TIndex>(range, func, cnt); Table<TEntry, TIndex> table = CreateTable<TEntry, TIndex>(range, func, cnt);
ParallelForRange ParallelForRange
(table.Range(), [&] (auto myrange) (table.Range(), [&] (auto myrange)

View File

@ -18,11 +18,11 @@ namespace netgen
void AnisotropicClusters :: Update(NgTaskManager tm, NgTracer tracer) 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 timer1 = NgProfiler::CreateTimer ("clusters1");
// static int timer2 = NgProfiler::CreateTimer ("clusters2"); // static int timer2 = NgProfiler::CreateTimer ("clusters2");
// static int timer3 = NgProfiler::CreateTimer ("clusters3"); // static int timer3 = NgProfiler::CreateTimer ("clusters3");
NgProfiler::RegionTimer reg (timer); RegionTimer reg (timer);
const MeshTopology & top = mesh.GetTopology(); const MeshTopology & top = mesh.GetTopology();
@ -215,7 +215,8 @@ namespace netgen
do do
{ {
(*tracer) ("update cluster, identify", false); static Timer t("update cluster, identify");
RegionTimer rtr(t);
cnt++; cnt++;
changed = 0; changed = 0;
@ -338,7 +339,6 @@ namespace netgen
} }
*/ */
} }
(*tracer) ("update cluster, identify", true);
} }
while (changed); while (changed);
// NgProfiler::StopTimer(timer3); // NgProfiler::StopTimer(timer3);

View File

@ -916,6 +916,7 @@ namespace netgen
void Mesh :: Load (istream & infile) void Mesh :: Load (istream & infile)
{ {
static Timer timer("Mesh::Load"); RegionTimer rt(timer);
if (! (infile.good()) ) if (! (infile.good()) )
{ {
cout << "cannot load mesh" << endl; cout << "cannot load mesh" << endl;
@ -956,6 +957,7 @@ namespace netgen
if (strcmp (str, "surfaceelements") == 0 || strcmp (str, "surfaceelementsgi")==0 || strcmp (str, "surfaceelementsuv") == 0) if (strcmp (str, "surfaceelements") == 0 || strcmp (str, "surfaceelementsgi")==0 || strcmp (str, "surfaceelementsuv") == 0)
{ {
static Timer t1("read surface elements"); RegionTimer rt1(t1);
infile >> n; infile >> n;
PrintMessage (3, n, " surface elements"); PrintMessage (3, n, " surface elements");
@ -1020,6 +1022,7 @@ namespace netgen
if (strcmp (str, "volumeelements") == 0) if (strcmp (str, "volumeelements") == 0)
{ {
static Timer t1("read volume elements"); RegionTimer rt1(t1);
infile >> n; infile >> n;
PrintMessage (3, n, " volume elements"); PrintMessage (3, n, " volume elements");
for (i = 1; i <= n; i++) for (i = 1; i <= n; i++)
@ -1045,6 +1048,7 @@ namespace netgen
if (strcmp (str, "edgesegments") == 0) if (strcmp (str, "edgesegments") == 0)
{ {
static Timer t1("read edge segments"); RegionTimer rt1(t1);
infile >> n; infile >> n;
for (i = 1; i <= n; i++) for (i = 1; i <= n; i++)
{ {
@ -1059,6 +1063,7 @@ namespace netgen
if (strcmp (str, "edgesegmentsgi") == 0) if (strcmp (str, "edgesegmentsgi") == 0)
{ {
static Timer t1("read edge segmentsgi"); RegionTimer rt1(t1);
infile >> n; infile >> n;
for (i = 1; i <= n; i++) for (i = 1; i <= n; i++)
{ {
@ -1073,6 +1078,7 @@ namespace netgen
if (strcmp (str, "edgesegmentsgi2") == 0) if (strcmp (str, "edgesegmentsgi2") == 0)
{ {
static Timer t1("read edge segmentsgi2"); RegionTimer rt1(t1);
int a; int a;
infile >> a; infile >> a;
n=a; n=a;
@ -1106,6 +1112,7 @@ namespace netgen
if (strcmp (str, "points") == 0) if (strcmp (str, "points") == 0)
{ {
static Timer t1("read points"); RegionTimer rt1(t1);
infile >> n; infile >> n;
PrintMessage (3, n, " points"); PrintMessage (3, n, " points");
for (i = 1; i <= n; i++) for (i = 1; i <= n; i++)
@ -1122,6 +1129,7 @@ namespace netgen
if (strcmp (str, "pointelements") == 0) if (strcmp (str, "pointelements") == 0)
{ {
static Timer t1("read point elements"); RegionTimer rt1(t1);
infile >> n; infile >> n;
PrintMessage (3, n, " pointelements"); PrintMessage (3, n, " pointelements");
for (i = 1; i <= n; i++) for (i = 1; i <= n; i++)

View File

@ -368,6 +368,7 @@ namespace netgen
void MeshTopology :: Update (NgTaskManager tm_unused, NgTracer tracer) void MeshTopology :: Update (NgTaskManager tm_unused, NgTracer tracer)
{ {
static Timer timer("Topology::Update"); static Timer timer("Topology::Update");
static Timer timer_tables("Build vertex to element table");
RegionTimer reg (timer); RegionTimer reg (timer);
#ifdef PARALLEL #ifdef PARALLEL
@ -406,6 +407,7 @@ namespace netgen
vertex to segment vertex to segment
*/ */
timer_tables.Start();
vert2element = mesh->CreatePoint2ElementTable(); vert2element = mesh->CreatePoint2ElementTable();
vert2surfelement = mesh->CreatePoint2SurfaceElementTable(0); vert2surfelement = mesh->CreatePoint2SurfaceElementTable(0);
@ -423,6 +425,7 @@ namespace netgen
const Element0d & pointel = mesh->pointelements[pei]; const Element0d & pointel = mesh->pointelements[pei];
table.Add(pointel.pnum, pei); table.Add(pointel.pnum, pei);
}, np); }, np);
timer_tables.Stop();
(*tracer) ("Topology::Update setup tables", true); (*tracer) ("Topology::Update setup tables", true);
@ -430,8 +433,8 @@ namespace netgen
if (buildedges) if (buildedges)
{ {
static int timer1 = NgProfiler::CreateTimer ("topology::buildedges"); static Timer timer1("topology::buildedges");
NgProfiler::RegionTimer reg1 (timer1); RegionTimer reg1(timer1);
if (id == 0) if (id == 0)
PrintMessage (5, "Update edges "); PrintMessage (5, "Update edges ");
@ -894,12 +897,12 @@ namespace netgen
// generate faces // generate faces
if (buildfaces) if (buildfaces)
{ {
static int timer2 = NgProfiler::CreateTimer ("topology::buildfaces"); static Timer timer2("topology::buildfaces");
// static int timer2a = NgProfiler::CreateTimer ("topology::buildfacesa"); // static int timer2a = NgProfiler::CreateTimer ("topology::buildfacesa");
// static int timer2b = NgProfiler::CreateTimer ("topology::buildfacesb"); // static int timer2b = NgProfiler::CreateTimer ("topology::buildfacesb");
// static int timer2b1 = NgProfiler::CreateTimer ("topology::buildfacesb1"); // static int timer2b1 = NgProfiler::CreateTimer ("topology::buildfacesb1");
// static int timer2c = NgProfiler::CreateTimer ("topology::buildfacesc"); // static int timer2c = NgProfiler::CreateTimer ("topology::buildfacesc");
NgProfiler::RegionTimer reg2 (timer2); RegionTimer reg2 (timer2);
if (id == 0) if (id == 0)
PrintMessage (5, "Update faces "); PrintMessage (5, "Update faces ");