Skip to content

Commit

Permalink
Merge pull request #16851 from kenrowland/HPCC-28789
Browse files Browse the repository at this point in the history
HPCC-28789 Keep ESP service execution profile enable per defined service

Reviewed-By: Anthony Fishbeck [email protected]
Merged-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday authored Jan 24, 2023
2 parents 52cafb9 + 8719496 commit 74bd46a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
36 changes: 21 additions & 15 deletions tools/hidl/hidlcomp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7143,11 +7143,7 @@ void HIDLcompiler::processExecutionProfiling()
for (si=servs; si; si=si->next)
{
StrBuffer serviceProfilingOptions;
bool serviceProfileExecutionEnabled = si->getMetaStringValue(serviceProfilingOptions,"profile_execution");

//
// At the HIDL top level, execution profiling is enabled if any service is enabled
executionProfilingEnabled |= serviceProfileExecutionEnabled;
si->executionProfilingEnabled = si->getMetaStringValue(serviceProfilingOptions,"profile_execution");

//
// Go through each method and save any profile information to make if faster later when
Expand All @@ -7160,8 +7156,8 @@ void HIDLcompiler::processExecutionProfiling()
// Collect method profile execution values
StrBuffer methodProfilingOptions;
bool methodProfileExecutionEnabled = mthi->getMetaStringValue(methodProfilingOptions, "profile_execution");
executionProfilingEnabled |= methodProfileExecutionEnabled; // again, if a method is enabled, set top flag
if (serviceProfileExecutionEnabled || methodProfileExecutionEnabled)
si->executionProfilingEnabled |= methodProfileExecutionEnabled; // again, if a method is enabled, set top flag
if (si->executionProfilingEnabled || methodProfileExecutionEnabled)
{
if (!mthi->getMetaInt("no_profile_execution"))
{
Expand All @@ -7185,11 +7181,18 @@ void HIDLcompiler::write_esp()
outf("#define %s_ESPGEN_INCLUDED\n\n", packagename);
outf("#include \"%s_esp.ipp\"\n", packagename);

if (executionProfilingEnabled)
// If any defined service has execution profiling enabled, add the required includes
EspServInfo *si;
for (si=servs;si;si=si->next)
{
outs("#include \"espcommon.hpp\"\n");
outs("#include \"jmetrics.hpp\"\n");
if (si->executionProfilingEnabled)
{
outs("#include \"espcommon.hpp\"\n");
outs("#include \"jmetrics.hpp\"\n");
break;
}
}

outs("\n");
outs("#ifdef _WIN32\n");
outs("#include \"edwin.h\"\n");
Expand All @@ -7204,7 +7207,6 @@ void HIDLcompiler::write_esp()
mi->write_esp();
}

EspServInfo *si;
for (si=servs;si;si=si->next)
{
si->write_esp_binding();
Expand Down Expand Up @@ -7252,10 +7254,15 @@ void HIDLcompiler::write_esp_ex_ipp()
outs("\n\n");

// metrics execution profiling requires the memory header
if (executionProfilingEnabled)
EspServInfo *si;
for (si=servs;si;si=si->next)
{
outs("#include <memory>\n");
outs("\n\n");
if (si->executionProfilingEnabled)
{
outs("#include <memory>\n");
outs("\n\n");
break;
}
}

outf("namespace %s\n{\n\n", packagename);
Expand All @@ -7266,7 +7273,6 @@ void HIDLcompiler::write_esp_ex_ipp()
mi->write_esp_ipp();
}

EspServInfo *si;
for (si=servs;si;si=si->next)
{
si->write_esp_service_ipp();
Expand Down
4 changes: 3 additions & 1 deletion tools/hidl/hidlcomp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,9 @@ class EspServInfo
char *base_;
bool needsXslt;

public:
bool executionProfilingEnabled = false;


public:
EspServInfo(const char *name)
Expand Down Expand Up @@ -1335,7 +1338,6 @@ class HIDLcompiler
EspMessageInfo *msgs;
EspServInfo *servs;
IncludeInfo *includes;
bool executionProfilingEnabled = false;
};


Expand Down

0 comments on commit 74bd46a

Please sign in to comment.