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>
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;
if(cnt)
@ -375,6 +377,8 @@ namespace ngcore
template <typename TEntry, typename TIndex, typename TRange, typename TFunc>
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);
ParallelForRange
(table.Range(), [&] (auto myrange)

View File

@ -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);

View File

@ -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++)

View File

@ -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 ");