Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
OpenFOAM-plus
Commits
99e90b4e
Commit
99e90b4e
authored
Apr 19, 2017
by
mark
Browse files
BUG: name collision on profiling (issue
#440
)
parent
ceb076db
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/global/profiling/profiling.C
View file @
99e90b4e
...
...
@@ -37,16 +37,21 @@ Foam::profiling* Foam::profiling::pool_(0);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam
::
profilingInformation
*
Foam
::
profiling
::
find
(
const
string
&
name
)
Foam
::
profilingInformation
*
Foam
::
profiling
::
find
(
const
string
&
descr
,
const
label
parentId
)
{
StorageContainer
::
iterator
iter
=
hash_
.
find
(
name
);
return
(
iter
!=
hash_
.
e
nd
()
?
iter
()
:
0
);
StorageContainer
::
iterator
iter
=
hash_
.
find
(
Key
(
descr
,
parentId
)
);
return
(
iter
.
fou
nd
()
?
iter
()
:
0
);
}
Foam
::
profilingInformation
*
Foam
::
profiling
::
store
(
profilingInformation
*
info
)
{
hash_
.
insert
(
info
->
description
(),
info
);
// Profile information lookup is qualified by parent id
hash_
.
insert
(
Key
(
info
->
description
(),
info
->
parent
().
id
()),
info
);
return
info
;
}
...
...
@@ -174,7 +179,7 @@ Foam::profilingInformation* Foam::profiling::New
{
profilingInformation
*
parent
=
pool_
->
stack_
.
top
();
info
=
pool_
->
find
(
descr
);
info
=
pool_
->
find
(
descr
,
parent
->
id
()
);
if
(
!
info
)
{
info
=
pool_
->
store
(
new
profilingInformation
(
descr
,
parent
));
...
...
src/OpenFOAM/global/profiling/profiling.H
View file @
99e90b4e
...
...
@@ -87,10 +87,35 @@ public:
private:
// Private typedefs
// Private
classes,
typedefs
typedef
profilingSysInfo
sysInfo
;
typedef
HashPtrTable
<
Information
,
string
>
StorageContainer
;
//- Profile information lookup is qualified by parent id
typedef
Tuple2
<
string
,
label
>
Key
;
//- Hashing for information lookup
class
HashKey
:
public
Hash
<
Key
>
{
public:
HashKey
()
{}
//- Hash qualified by the parent id to avoid collisions
unsigned
operator
()(
const
Key
&
key
)
const
{
return
(
Hash
<
string
>
()(
key
.
first
())
+
Hash
<
label
>
()(
key
.
second
())
);
}
};
typedef
HashPtrTable
<
Information
,
Key
,
HashKey
>
StorageContainer
;
typedef
LIFOStack
<
Information
*>
StackContainer
;
...
...
@@ -164,8 +189,9 @@ protected:
// Protected Member Functions
//- Find named profiling information element or null on failure
profilingInformation
*
find
(
const
string
&
name
);
//- Find named profiling information element with specified parent.
// Return nullptr on failure.
profilingInformation
*
find
(
const
string
&
descr
,
const
label
parentId
);
//- Add to hashed storage,
// returns pointer to newly stored element for chaining
...
...
src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C
View file @
99e90b4e
...
...
@@ -59,7 +59,12 @@ Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solve
const
dictionary
&
solverControls
)
{
addProfiling
(
solve
,
"fvMatrix::solve."
+
psi_
.
name
());
word
regionName
;
if
(
psi_
.
mesh
().
name
()
!=
polyMesh
::
defaultRegion
)
{
regionName
=
psi_
.
mesh
().
name
()
+
"::"
;
}
addProfiling
(
solve
,
"fvMatrix::solve."
+
regionName
+
psi_
.
name
());
if
(
debug
)
{
...
...
src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C
View file @
99e90b4e
...
...
@@ -60,7 +60,12 @@ Foam::fvMatrix<Foam::scalar>::solver
const
dictionary
&
solverControls
)
{
addProfiling
(
solve
,
"fvMatrix::solve."
+
psi_
.
name
());
word
regionName
;
if
(
psi_
.
mesh
().
name
()
!=
polyMesh
::
defaultRegion
)
{
regionName
=
psi_
.
mesh
().
name
()
+
"::"
;
}
addProfiling
(
solve
,
"fvMatrix::solve."
+
regionName
+
psi_
.
name
());
if
(
debug
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment