Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide better information regarding memory usage by each plugin #6794

Conversation

@czolnowski
Copy link
Contributor

czolnowski commented Dec 3, 2014

I have implemented this issue: #6708
Also I have discussed this with issue author and it looks like good implementation of his idea. @mattab what you think? Should be more or this is enough for this PR?

* @param int $precision Precision value, default 2.
* @return string
*/
public static function bytesToSize($bytes, $precision = 2)

This comment has been minimized.

Copy link
@mattab

mattab Dec 3, 2014

Member

Did you maybe miss that we have Formatter::getPrettySizeFromBytes ?
before implementing something always search in the codebase. for example I search for 1024 and find all code that does stuff with bytes/kb and I found this function.

@@ -110,6 +112,14 @@ public function callAggregateAllPlugins($visits, $visitsConverted)

$archiver->aggregateMultipleReports();
}

$memoryUsageInArchiving = memory_get_usage(true) - $memoryUsageBeforePluginArchiving;

This comment has been minimized.

Copy link
@mattab

mattab Dec 3, 2014

Member

to get the memory usage can you try re-use the Timer object which has getMemoryLeak() etc. ?

Log::debug("PluginsArchiver::%s: Used %s memory while archiving %s reports for plugin '%s'.",
__FUNCTION__,
Piwik::bytesToSize($memoryUsageInArchiving),
$this->isSingleSiteDayArchive ? 'day' : 'period',

This comment has been minimized.

Copy link
@mattab

mattab Dec 3, 2014

Member

here you can do $this->params->getPeriod()->getLabel() or so

@czolnowski

This comment has been minimized.

Copy link
Contributor Author

czolnowski commented Dec 4, 2014

Hello @mattab,
thanks for your review! I changed the code according to your review comments. I hope that now it looks much better.

mattab pushed a commit that referenced this pull request Dec 4, 2014
…ion-of-memory-usage-in-archiving

Provide better information regarding memory usage by each plugin
@mattab mattab merged commit 7ab9fdd into matomo-org:master Dec 4, 2014
1 check failed
1 check failed
continuous-integration/travis-ci The Travis CI build could not complete due to an error
Details
@mattab

This comment has been minimized.

Copy link
Member

mattab commented Dec 4, 2014

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.