[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-frameworks-devel
Subject: Re: Review Request 126894: Refactor the listjobtest to allow listing of multile paths.
From: Frank Reininghaus <frank78ac () googlemail ! com>
Date: 2016-01-27 6:33:05
Message-ID: 20160127063305.17778.62901 () mimi ! kde ! org
[Download RAW message or body]
--===============7617360562505087582==
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/126894/#review91634
-----------------------------------------------------------
Thanks Milian for looking at this test. I implemented it quite some time ago as a quick hack that allows \
to see how changes in the internal data structures of UDSEntry affect the performance and especially the \
memory usage of KIO::ListJob (which is what applications typically use to obtain UDSEntries). I did it in \
Qt4 times, when one could not use lambdas in connections. It's great to see the test simplified and \
extended now :-)
I have two remarks:
* Appending the listed entries to a list was intentional. If they are discarded immediately, then their \
memory is freed, and it is not possible to see how much memory the entries would consume in an \
application that lists one or more paths. I see that this original intention of the test is not obvious \
at all though. I should have added a comment - sorry about that!
* The `std::cin.ignore()` was also intentional. It allows to investigate the memory usage with htop, ps, \
or other tools while the process is still running. I know that one could also use \
Valgrind/Massif+massif-visualizer to get a detailed memory usage report (which also contains detailed \
information about where and when memory was allocated), but this has the disadvantage that the \
bookkeeping overhead of the memory allocator is not included (or at least it was not last time I \
checked). The massif method would tell you that an application that allocates 100 MiB in a single block \
uses more memory than an application that allocates 10 million blocks of 8 bytes each, but this is not \
true because some bookkeeping overhead is added to each allocation. Each allocation takes at least 32 \
bytes of memory when using GCC+glibc on a 64-bit system. But I guess that there must be a better way than \
the `cin.ignore()` hack to easily get the real memory usage.
- Frank Reininghaus
On Jan. 26, 2016, 3:34 nachm., Milian Wolff wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/126894/
> -----------------------------------------------------------
>
> (Updated Jan. 26, 2016, 3:34 nachm.)
>
>
> Review request for KDE Frameworks and David Faure.
>
>
> Repository: kio
>
>
> Description
> -------
>
> With this change it is now possible to list multiple paths
> as defined via the command line.
>
> While at it, I refactored the code to clean it up:
>
> - rely on QEventLoopLocker to quit the application once all jobs
> have finished
> - use a lambda to count the listed entries
> - don't append to a KIO::UDSEntryList to cound the listed entries
>
>
> Diffs
> -----
>
> tests/listjobtest.cpp 702b09950734894a9f82746d58071225419b4e3f
>
> Diff: https://git.reviewboard.kde.org/r/126894/diff/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Milian Wolff
>
>
--===============7617360562505087582==
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 7bit
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 solid; \
border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;"> <tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://git.reviewboard.kde.org/r/126894/">https://git.reviewboard.kde.org/r/126894/</a>
</td>
</tr>
</table>
<br />
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: \
-o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">Thanks Milian for looking at this test. I implemented it quite some time \
ago as a quick hack that allows to see how changes in the internal data structures of UDSEntry affect the \
performance and especially the memory usage of KIO::ListJob (which is what applications typically use to \
obtain UDSEntries). I did it in Qt4 times, when one could not use lambdas in connections. It's great to \
see the test simplified and extended now :-)</p> <p style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: inherit;">I have two remarks:</p> <ul style="padding: \
0;text-rendering: inherit;margin: 0 0 0 1em;line-height: inherit;white-space: normal;"> <li \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">Appending \
the listed entries to a list was intentional. If they are discarded immediately, then their memory is \
freed, and it is not possible to see how much memory the entries would consume in an application that \
lists one or more paths. I see that this original intention of the test is not obvious at all though. I \
should have added a comment - sorry about that!</li> <li style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: normal;">The <code style="text-rendering: \
inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: \
inherit;">std::cin.ignore()</code> was also intentional. It allows to investigate the memory usage with \
htop, ps, or other tools while the process is still running. I know that one could also use \
Valgrind/Massif+massif-visualizer to get a detailed memory usage report (which also contains detailed \
information about where and when memory was allocated), but this has the disadvantage that the \
bookkeeping overhead of the memory allocator is not included (or at least it was not last time I \
checked). The massif method would tell you that an application that allocates 100 MiB in a single block \
uses more memory than an application that allocates 10 million blocks of 8 bytes each, but this is not \
true because some bookkeeping overhead is added to each allocation. Each allocation takes at least 32 \
bytes of memory when using GCC+glibc on a 64-bit system. But I guess that there must be a better way than \
the <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: \
0;line-height: inherit;">cin.ignore()</code> hack to easily get the real memory usage.</li> </ul></pre>
<br />
<p>- Frank Reininghaus</p>
<br />
<p>On Januar 26th, 2016, 3:34 nachm. UTC, Milian Wolff wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: 1px #888a85 solid; \
border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;"> <tr>
<td>
<div>Review request for KDE Frameworks and David Faure.</div>
<div>By Milian Wolff.</div>
<p style="color: grey;"><i>Updated Jan. 26, 2016, 3:34 nachm.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
kio
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid \
#b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">With this change it is now possible to list \
multiple paths as defined via the command line.
While at it, I refactored the code to clean it up:
- rely on QEventLoopLocker to quit the application once all jobs
have finished
- use a lambda to count the listed entries
- don't append to a KIO::UDSEntryList to cound the listed entries</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>tests/listjobtest.cpp <span style="color: \
grey">(702b09950734894a9f82746d58071225419b4e3f)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/126894/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
--===============7617360562505087582==--
[Attachment #3 (text/plain)]
_______________________________________________
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic