diff options
| author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2009-03-06 14:53:16 +1000 |
|---|---|---|
| committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2009-03-06 14:53:16 +1000 |
| commit | 81ecf6284389848672c990255c395ad88bd8417c (patch) | |
| tree | aecde23b72682cd838af5aa32e2fb66f8ea5e4d3 /benchmarks/tst_messageserver/testfsusage.cpp | |
| parent | 16fd6dae77b47d8be1cf20423e2a1a75581aa278 (diff) | |
Separate tst_messageserver benchmark from rest of tests, for Pulse and because
the test takes much longer to run than the rest.
Diffstat (limited to 'benchmarks/tst_messageserver/testfsusage.cpp')
| -rw-r--r-- | benchmarks/tst_messageserver/testfsusage.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/benchmarks/tst_messageserver/testfsusage.cpp b/benchmarks/tst_messageserver/testfsusage.cpp new file mode 100644 index 00000000..63f76b92 --- /dev/null +++ b/benchmarks/tst_messageserver/testfsusage.cpp @@ -0,0 +1,29 @@ +/**************************************************************************** +** +** This file is part of the $PACKAGE_NAME$. +** +** Copyright (C) $THISYEAR$ $COMPANY_NAME$. +** +** $QT_EXTENDED_DUAL_LICENSE$ +** +****************************************************************************/ + +#include "testfsusage.h" + +#include <QDir> +#include <QFileInfo> + +qint64 TestFsUsage::usage(QString const& path) +{ + qint64 ret = 0; + QFileInfo fi(path); + ret += fi.size(); + if (!fi.isSymLink() && fi.isDir()) { + QDir dir(fi.absoluteFilePath()); + foreach (QString const& name, dir.entryList(QDir::NoDotAndDotDot|QDir::AllEntries)) { + ret += usage(path + "/" + name); + } + } + return ret; +} + |
