Skip to content

Commit

Permalink
HPCC-32823 Add time waiting for git lock to the workunit stats
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday committed Oct 30, 2024
1 parent cf4b015 commit bf6465c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ecl/eclcc/eclcc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1535,8 +1535,11 @@ void EclCC::processSingleQuery(const EclRepositoryManager & localRepositoryManag

updateWorkunitStat(instance.wu, SSToperation, ">compile:>parse", StTimeElapsed, NULL, parseTimeNs);
stat_type sourceDownloadTime = localRepositoryManager.getStatistic(StTimeElapsed);
stat_type sourceDownloadBlockedTime = localRepositoryManager.getStatistic(StTimeBlocked);
if (sourceDownloadTime)
updateWorkunitStat(instance.wu, SSToperation, ">compile:>parse:>download", StTimeElapsed, NULL, sourceDownloadTime);
if (sourceDownloadBlockedTime)
updateWorkunitStat(instance.wu, SSToperation, ">compile:>parse:>download", StTimeBlocked, NULL, sourceDownloadBlockedTime);

if (optExtraStats)
{
Expand Down
11 changes: 9 additions & 2 deletions ecl/hql/hqlrepository.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,8 @@ unsigned __int64 EclRepositoryManager::getStatistic(StatisticKind kind) const
{
case StTimeElapsed:
return cycle_to_nanosec(gitDownloadCycles);
case StTimeBlocked:
return cycle_to_nanosec(gitDownloadBlockedCycles);
}
return 0;
}
Expand Down Expand Up @@ -823,7 +825,12 @@ IEclSourceCollection * EclRepositoryManager::resolveGitCollection(const char * r
throw makeStringExceptionV(99, "Unsupported repository link format '%s'", defaultUrl);

bool alreadyExists = false;

CCycleTimer gitDownloadTimer;
Owned<IInterface> gitUpdateLock(getGitUpdateLock(repoPath));
cycle_t blockedCycles = gitDownloadTimer.elapsedCycles();
gitDownloadBlockedCycles += blockedCycles;

if (checkDirExists(repoPath))
{
if (options.cleanRepos)
Expand Down Expand Up @@ -853,7 +860,6 @@ IEclSourceCollection * EclRepositoryManager::resolveGitCollection(const char * r

bool ok = false;
Owned<IError> error;
CCycleTimer gitDownloadTimer;
if (alreadyExists)
{
if (options.updateRepos)
Expand Down Expand Up @@ -890,7 +896,8 @@ IEclSourceCollection * EclRepositoryManager::resolveGitCollection(const char * r
//this could become a read/write lock if that proved to be an issue.
gitUpdateLock.clear();

gitDownloadCycles += gitDownloadTimer.elapsedCycles();
gitDownloadCycles += (gitDownloadTimer.elapsedCycles() - blockedCycles);

if (error)
{
if (errorReceiver)
Expand Down
1 change: 1 addition & 0 deletions ecl/hql/hqlrepository.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class HQL_API EclRepositoryManager
IArrayOf<IEclRepository> overrideSources; // -D options
IArrayOf<IEclRepository> allSources; // also includes -D options
cycle_t gitDownloadCycles = 0;
cycle_t gitDownloadBlockedCycles = 0;

//Include all options in a nested struct to make it easy to ensure they are cloned
struct {
Expand Down

0 comments on commit bf6465c

Please sign in to comment.