Blog Syndicate content

  • » Heaptrack - Attaching to Running Process

    Tue, 12/09/2014 - 23:02

    Hello all,

    I’m happy to be back so soon with a status update on heaptrack: It is now possible to attach to an already running process!

    Thanks to the great help from Celelibi on StackOverflow, I managed to achieve this important goal. Once you know what to do, it is actually extremely simple to patch a running process. I use GDB to attach to the process, then call dlopen to load a special heaptrack library for runtime-injection. Then I call an initialization function which takes the desired output file as a parameter, and then detach GDB. To actually overwrite malloc & friends, one can leverage dl_iterate_phdr and the public ELF API on Linux systems to find dynamic sections that reference one of our target symbols in their global offset table (GOT). This can then be rewritten to point to our custom hooks. Some refactoring later, which stabilized the shutdown sequence to allows multiple heaptrack attach/detach sequences, we can now do this:

    1. heaptrack -p $(pidof <yourapp>)
    2. # wait
    3. ^C
    4. heaptrack_print heaptrack.<yourapp>.$$.gz | less

    This is a great help when you want to investigate why the memory consumption of your application suddenly rises. No need to restart the app, just attach heaptrack and wait for some, then kill it and heaptrack_print the outputfile.

    Please try this new feature and send me bug reports and feedback.

    Cheers

  • » Heaptrack - A Heap Memory Profiler for Linux

    Tue, 12/02/2014 - 19:25

    Hello everyone,

    with a tingly feeling in my belly, I’m happy to announce heaptrack, a heap memory profiler for Linux. Over the last couple of months I’ve worked on this new tool in my free time. What started as a “what if” experiment quickly became such a promising tool that I couldn’t stop working on it, at the cost of neglecting my physics masters thesis (who needs that anyways, eh?). In the following, I’ll show you how to use this tool, and why you should start using it.

  • » Massif-Visualizer 0.4 and KGraphViewer 2.2 Released!

    Mon, 11/17/2014 - 17:53

    Hello all!

    I’m happy to (finally!) announce the release of the latest stable versions of Massif-Visualizer and KGraphViewer:

    Both versions come filled with bug fixes, cleanups and performance improvements. Everyone is urged to update!

    Cheers and many thanks to all contributors.

  • » KDevelop 4.7.0 Released

    Sat, 09/13/2014 - 20:50

    Hello all!

    It’s my pleasure to finally announce the availability of KDevelop 4.7.0:

    https://www.kdevelop.org/news/kdevelop-470-released

    This is a special release, as it marks the end of the KDE 4 era for us in terms of feature development. We will continue to support this release in the long-term with bug fixes though. New things and fundamental changes will only happen in the frameworkified master branches from now an.

    Many thanks to all contributors!

    Cheers

  • » An optimization kata - profiling 101 at Akademy 2014

    Tue, 09/09/2014 - 15:43

    Yesterday my Profiling 101 workshop took place at this years Akademy in Brno. The room was packed and I got good feedback, so I hope you all learned something new :)

    During my workshop, I showed you how to improve the performance of a word-count application which also creates a word histogram and finds the longest word of a file. I tried to put as many performance bottlenecks as possible into the original code base, which you can find here:

    1. git clone git@git.kde.org:scratch/mwolff/akademy-2014.git

    Instead of uploading my useless slides full of meme images, instead I’m now pushing my optimized code branch. I urge everyone to review the commits I did and read the individual commit messages (Note: read this log from bottom to top). There are many useful tips and tricks in there. I furthermore plan to create a techbase article with the most important notes on how to use profilers for a given job. I’ll write another blog post once I’m done with that.

    Furthermore, if you want to learn profiling, I think my scratch repo up there is a good coding kata. Branch off from the master branch and create your own optimized one. Use profilers such as Valgrind callgrind and Linux perf for CPU runtime. Try out Massif and heaptrack for memory.

    I hope together we can make KDE software much faster. There are probably many low-hanging fruit throughout our large codebase. If you have any question, please do ask me.

    Cheers, enjoy the rest of Akademy. Many thanks to the organizers, sponsors and the KDE e.V.!

  • » KDevelop master is now frameworkified

    Thu, 08/28/2014 - 01:25

    Hello all!

    Kevin just announced it on the mailing list, the CI is still shaking it’s head, and we are all very curious about the coming weeks: KDevelop’s master branches are now depending on KF5!

    For more information, see: https://www.kdevelop.org/frameworks/kdevelop-master-now-depends-kde-fram…

    Cheers, happy hacking and hope to see some more patches :)

  • » Akademy 2014 - Come to my Profiling 101 Workshop!

    Tue, 08/26/2014 - 19:08

    Hello all!

    I have the pleasure to attend Akademy this year again. From my past experience, I’m really looking forward to have a good time again. Lots of hacking, meeting known and unknown faces, drinking beer and socializing ahead! I also love that it’s in a (to me) new country again, and wonder what I will see of the Czech Republic and Brno!

    This year, the conference schedule is a bit different from the past years. Not only do we have the usual two days packed with interesting talks and keynotes. No - this year there will also be workshops on the third day! These are more in-depth talks which hopefully teach the audience some new skills, be it QML, mobile development, testing, or … profiling :) Your’s truly has the honor to hold a one-hour Profiling 101 workshop.


    I’m going to Akademy and will hold a Profiling 101 Workshop

    I welcome all of you to attend my presentation. My plan, currently, is to do some life demoing of how I profile and optimize code. For that purpose, I just wrote a (really slow and badly written) word count test-app. I pushed the sources to kde:scratch/mwolff/akademy-2014.git. If you plan to join my workshop, I encourage you to download the sources and take a shot at optimizing it. I tried my best to write slow code this time, to leave plenty of opportunity for optimizations :) There are many low-hanging fruits in the code. I’m confident that I’ll be able to teach you some more advanced tips and tricks on how you can improve a Qt application’s performance. We’ll see in the end who can come up with the fastest version :)

    During my workshop, I’ll investigate the performance of the wordcount app with various tools: On one hand this should teach you how to use the powerful existing opensource tools such as Linux perf and the valgrind suite. I will also show you Intel VTune though, as it is still unparalleled in many aspects and available free-of-charge for non-commercial usage on Linux. Then, I’ll present a few of my own tools to you, such as heaptrack. If you never heard of some of these tools, go try them out before Akademy!

    I’ll see what else I’ll fit in and maybe I’ll extend my akademy-2014.git scratch repository with more examples over the next days.

    Bye, hope to see you soon!

  • » KDevelop 4.7.0 Beta 1 Released

    Fri, 07/04/2014 - 10:54

    Hey all,

    just a quick announcement: KDevelop 4.7.0 Beta 1 was released! Head over to the announcement on the KDevelop website to read more:

    https://www.kdevelop.org/news/kdevelop-471-beta1-released

    Cheers, see you soon with a KDevelop 4.7.0 stable release :)

  • » Massif-Visualizer 0.4 Beta 1 and KGraphViewer 2.2 Beta 1 Released!

    Wed, 06/25/2014 - 13:44

    Hey all,

    I’m happy to announce the availability of two new betas: Massif-Visualizer 0.4 Beta 1 and KGraphViewer 2.2 Beta 1!

    Download

    If you want to test this release, you can download the tarballs from the KDE mirrors:

    Download Massif-Visualizer 0.4 Beta 1

    1. md5 sum: 2953089078bd2170ad9d2d583c7c8b95 massif-visualizer-0.3.90.tar.xz
    2. sha1 sum: 6d76134b1b41b887ba595a0585f941d22e066b76 massif-visualizer-0.3.90.tar.xz
    3. sha256 sum: 9940fa90137ca5eef08b9ec220825fadbf03db423a670a2c7fe3edab271d9922 massif-visualizer-0.3.90.tar.xz

    Download KGraphViewer 2.2 Beta 1

    1. md5 sum: b3a18cbaf661d1cf186b3a3674c31186 kgraphviewer-2.1.90.tar.xz
    2. sha1 sum: 4f0cb86f01eb9725191a79291cbd75061682ca69 kgraphviewer-2.1.90.tar.xz
    3. sha256 sum: 1ae74c1a51e252e88afb7a3d7864fc1bc6326c191ad36c89cc7fab7e8a96f08f kgraphviewer-2.1.90.tar.xz
    Notably Changes

    These beta releases come packed with a lot of important changes. KGraphViewer finally supports newer GraphViz packages and includes many performance optimizations and other bug fixes. Massif-Visualizer saw a lot of code cleanup and a few visual changes, which make it possible to open multiple files at once in the same window.

    Thanks go out to all contributors, who made this release possible!

    Massif-Visualizer Changelog
    • Milian Wolff: Centralize version handling and set version to 0.3.90 for beta release
    • Milian Wolff: Replace empty string literals with explicit empty string/byte array.
    • Milian Wolff: Cleanup the cmake code around our internal helper libs a bit.
    • Milian Wolff: Cleanup, use .at(0) instead of first() as that is guaranteed to never detach.
    • Milian Wolff: Optimize: force the use of the const overload of QVector::first.
    • Milian Wolff: Constify the data pointers where possible.
    • Yuri Chornoivan: Fix typo
    • Arnold Dumas: Don’t enable ‘reload’ action when no document has been loaded.
    • Burlen Loring: Implement logic to save current document as an image.
    • Burlen Loring: Add logic to control legend position and font size.
    • Milian Wolff: Don’t assert when kgraphviewer part is not available at runtime.
    • Milian Wolff: Update detailed graph view when changing selection in the tree view.
    • Arnold Dumas: Keep the displayed toolbar up to date with the current tab. REVIEW: 117752
    • Milian Wolff: Add myself as an author as well and fixup bugs address to direct to our mailing list.
    • Arnold Dumas: Add myself in the about dialog. While at it, update my e-mail.
    • Arnold Dumas: Remove broken useless connection.
    • Arnold Dumas: Support loading kgraphviewer via KPluginFactory. REVIEW: 117375 BUG: 332833
    • Arnold Dumas: Update my e-mail address.
    • Milian Wolff: Require cmake 2.8.9 as minimum version.
    • Milian Wolff: Require KDE 4.7.0 as minimum for KMessageWidget
    • Milian Wolff: improve backwards compatibility by using non-forward include for KMessageWidget.
    • Arnold Dumas: Fix spelling mistakes reported by Krazy2.
    • Arnold Dumas: More coherence when navigating through different documents. REVIEW: 114404
    • Arnold Dumas: Fix crash when changing the stack number value with an invalid document loaded.
    • Arnold Dumas: Disable printing when the document hasn’t be properly loaded.
    • Milian Wolff: Hide callgraph toolbar if we don’t show the callgraph currently.
    • Milian Wolff: Cleanup includes, use forward declarations in header.
    • Milian Wolff: Don’t use modal dialog to show parse errors.
    • Milian Wolff: Properly restore current index after file reload.
    • Milian Wolff: Disable stop parser only when no parsers are running.
    • Milian Wolff: Make helper functions static for file-local linkage.
    • Milian Wolff: Don’t access parseWorker API after deleteLater call.
    • Milian Wolff: Cleanup UI if we do not have KGraphViewer available.
    • Milian Wolff: Fixup issues after recent move to MDI.
    • Milian Wolff: Make compile when one has an outdated kgraphviewer available.
    • Arnold Dumas: Implementation of multiple document interface. REVIEW: 113523
    • Arnold Dumas: Remove unused or unnecessary includes. REVIEW: 113489
    • Arnold Dumas: Delete the print preview dialog just after it has been closed. REVIEW: 113288
    • Arnold Dumas: Add myself in the AUTHORS file.
    • Arnold Dumas: Add a preview dialog before printing. REVIEW: 113130
    • Arnold Dumas: Fix one more warning.
    • Arnold Dumas: Fix crash when toggling “Shorten templates” action without any proper massif document loaded. REVIEW: 113122
    • Arnold Dumas: Fix five warnings. REVIEW: 113106
    • David Faure: Fix compilation with -DQT_STRICT_ITERATORS
    • Milian Wolff: ups, add missing hunk, fixes compilation
    • Milian Wolff: Make it possible to print the massif data.
    • Milian Wolff: Use full horizontal space in chart
    • Milian Wolff: Minor cleanups
    • Milian Wolff: Kill QList usage with fire.
    • Milian Wolff: Refactor threaded parsing, use long lived worker pattern.
    • Milian Wolff: Fix double deletion in hideFunction.
    • Milian Wolff: Properly parse labels for functions, locations, addresses
    • Milian Wolff: add missing test data
    • Milian Wolff: add stack-profile test data
    • Milian Wolff: Support massif memory stack profiles.
    • Milian Wolff: Increase compatibility with older Qt versions.
    • Milian Wolff: show memory in kilobytes instead of bytes
    • Milian Wolff: remove top and left axes, instead increase font size of right and bottom axes
    • Milian Wolff: just show peak cost, without ‘Peak of …’ prefix
    • Milian Wolff: set monospace font on legend, left-align text
    • Yuri Chornoivan: Fix typo: remove->remote
    • Milian Wolff: fix crash when loading multiple files in parallel
    • Milian Wolff: optimize: .value() instead of .contains & operator[]
    • Milian Wolff: cleanup
    • Milian Wolff: optimize: leverage implitic QByteArray sharing to further reduce memory consumption
    • Milian Wolff: use something better for the fast-route tree filtering label
    • Milian Wolff: use contains check for custom allocators
    • Milian Wolff: optimize: filter for data tree model
    • Milian Wolff: properly show some progress values in the progress bar
    • Milian Wolff: actually make it possible to stop a parser run
    • Milian Wolff: load & parse massif files in a background thread
    • Milian Wolff: properly initialize to prevent crash in new dtor code
    • Milian Wolff: fix/workaround some memleaks in kdchart
    • Milian Wolff: fix memleak in tester
    • Milian Wolff: optimize: drastically reduce memory footprint by using QByteArray instead of QString
    • Milian Wolff: optimize: when we don’t have custom allocators, no need to find the function in the label
    • Milian Wolff: add simple debug utility to run massif parser on random files
    • Milian Wolff: move util.{h,cpp} to massifdata
    • Milian Wolff: optimize: use QHash instead of QMap if sort-order is not required
    • Milian Wolff: use quint64 for bytesizes to support memory > 4GB
    • Milian Wolff: properly calculate color based on accumulated max cost
    • Milian Wolff: kgraphviewer is optional
    • Milian Wolff: Relicense to GPL/LGPL v2.1 or 3 or anything later approved by KDE e.V.
    • Milian Wolff: add README/man page
    • Aurélien Gâteau: Link statically the kdchart lib
    • Aurélien Gâteau: Do not install internal static libs
    • Aurélien Gâteau: Remove need for an X server to run datamodeltest
    • Milian Wolff: merge below-threshold nodes
    • Milian Wolff: remove obsolete call
    • Milian Wolff: close file on shutdown to fix memleaks
    • Milian Wolff: make root item white, color is useless there
    • Milian Wolff: fix memleaks in unit test
    • Milian Wolff: properly find highest-cost node in callgraph node based on accumulated cost
    • Milian Wolff: merge tails of callgraph tree before generating the dot file
    • Michael Jansen: Qt 4.8: Resolve ambiguous overload (QVariant, QBrush)
    • Milian Wolff: set version to 0.4
    KGraphViewer Changelog
    • Milian Wolff: Restructure and centralize the version handling.
    • Gael de Chalendar: Avoid a crash when using recent files list
    • Gael de Chalendar: Removed unused slotLoadLibrary
    • Gael de Chalendar: Remove unused member
    • Reimar Döffinger: Add horrible hack to work around reload issue.
    • Reimar Döffinger: Merge declaration and initialization.
    • Reimar Döffinger: Ensure m_g is initialized even if fopen fails.
    • Reimar Döffinger: Revert “Do not crash anymore on reload”
    • Gael de Chalendar: Make recent files list to be filled again
    • Gael de Chalendar: Do not crash anymore on reload
    • Gael de Chalendar: Handle a graphviz error
    • Milian Wolff: Optimize: Cache string keys used for attribute lookup.
    • Milian Wolff: Optimize: Do manual painter restoration.
    • Milian Wolff: Optimize: Disable semi-expensive debug output generation.
    • Milian Wolff: Remove useless debug output which gets emitted a lot.
    • Yuri Chornoivan: Expand: algo -> algorithm
    • Matthias Klumpp: Add AppStream metadata
    • Gael de Chalendar: Add xdot 1.2, graphviz 2.13 Support image operator I
    • Gael de Chalendar: Add support for xdot 1.5, graphviz 2.34 new ‘t’ operator
    • David Faure: Port from queryExit to closeEvent, so queryExit can be deprecated
    • Reimar Döffinger: Remove dependency on Qt3Support.
    • Reimar Döffinger: Bump version number for the many recent changes.
    • Reimar Döffinger: Make code find the chain.png and chain-broken.png.
    • Reimar Döffinger: printing: Add hack to fix some strange random behaviour.
    • Reimar Döffinger: Remove unused variable.
    • Reimar Döffinger: Prefer using QPainter::boundingRect to get text size.
    • Reimar Döffinger: Printing: fix size calculations without date/time.
    • Reimar Döffinger: printing: get rid of pointless intermediate QImages.
    • Reimar Döffinger: printing: remove pointless duplicated setFont calls.
    • Reimar Döffinger: Printing: replace smoothScale() by scaled()
    • Reimar Döffinger: Print preview window: remove pointless customization.
    • Reimar Döffinger: simpleprintingengine.cpp: Simplify, do not rely on dynamic_cast.
    • Reimar Döffinger: Move QPaintDevice pointer out of class.
    • Reimar Döffinger: Remove unused function.
    • Reimar Döffinger: Change include order to match KDE recommendations.
    • Reimar Döffinger: Handle failure to load a file without crashing.
    • Reimar Döffinger: Support old graphviz via patch for the moment.
    • Reimar Döffinger: Update kcfg files to reference schema instead of DTD.
    • Reimar Döffinger: Fix placement of TRANS:ROLES_OF_TRANSLATORS
    • Reimar Döffinger: Spelling fixes in comments.
    • Reimar Döffinger: Change my email address to one I can still access.
    • Reimar Döffinger: Replace some Qt classes with KDE alternatives.
    • Reimar Döffinger: Avoid QString::null and use QString().
    • Reimar Döffinger: Fix some issues with threading.
    • Reimar Döffinger: Fix memory leak and make data structure const.
    • Reimar Döffinger: Fix file descriptor leak.
    • Reimar Döffinger: Simplify code to delete maps and also free all subgraphs.
    • Reimar Döffinger: kgrapheditor: Use only public API of our KPart.
    • Reimar Döffinger: Fix gvContext leaks.
    • Reimar Döffinger: Do not clear canvas on update.
    • Reimar Döffinger: Switch kgrapheditor to use the KPart.
    • Reimar Döffinger: Slightly simplify plugin load error handling.
    • Reimar Döffinger: kgrapheditor: Make it possible to have an active graph.
    • Reimar Döffinger: Add some debug prints.
    • Reimar Döffinger: kgrapheditor: Fix signal and slot signatures.
    • Reimar Döffinger: kgrapheditor: Make quit menu entry work.
    • Reimar Döffinger: Fix loading files in kgrapheditor.
    • Yuri Chornoivan: Fix typo
    • Reimar Döffinger: Normalize most signal/slot signatures.
    • Reimar Döffinger: Make 1-argument constructors explicit.
    • Reimar Döffinger: Follow recommendation to use QPointer for modal dialogs.
    • Reimar Döffinger: Show correct layout algorithm also for undirected graphs.
    • Reimar Döffinger: Update Changelog, short summary of major recent changes.
    • Reimar Döffinger: Fix code to enfore minimum size of zoom rectangle.
    • Reimar Döffinger: Fix incorrect clamps.
    • Reimar Döffinger: Minor code simplification for zoom rectangle adjustment.
    • Reimar Döffinger: Fixes for layout selection.
    • Reimar Döffinger: Set checkable to true.
    • Reimar Döffinger: Prefer KAction over QAction where appropriate.
    • Reimar Döffinger: Try to fix print setup page by removing fixed pixel positions.
    • Reimar Döffinger: Use empty string instead of single space for custom layout placeholder.
    • Reimar Döffinger: Reformat remaining three .ui files for consistency.
    • Reimar Döffinger: Make settings dialogs auto-layout themselves properly.
    • Reimar Döffinger: Convert .ui files to proper XML/newer format.
    • Reimar Döffinger: Allow proper auto-scaling of appearence preferences.
    • Reimar Döffinger: Remove spacer on top.
    • Reimar Döffinger: Use a simple QLabel instead of QTextEdit.
    • Reimar Döffinger: Remove broken code that messed up position when zooming.
    • Reimar Döffinger: Simplify scrollwheel scrolling code.
    • Reimar Döffinger: Fix keyboard navigation.
    • Reimar Döffinger: Simplify code handling detail level, avoid duplicating code.
    • Reimar Döffinger: Also allow zooming with Control + mouse wheel.
    • Reimar Döffinger: Use correct flag type for argument.
    • Reimar Döffinger: Add extra parenthesis to avoid compiler warning.
    • Reimar Döffinger: Remove unused variable.
    • Reimar Döffinger: Add explicit protected destructor.
    • Reimar Döffinger: Avoid some deprecated functions in page setup code.
    • Reimar Döffinger: Port to KPluginFactory.
    • Reimar Döffinger: Print error if opening the file failed.
    • Reimar Döffinger: Support newer graphviz cgraph library.
    • Reimar Döffinger: Fix parser to accept both int and floating-point in more places.
    • Burkhard Lück: fix typo BUG:331041
    • David Faure: Port away from deprecated QList::remove().
    • Pino Toscano: Remove erroneous double-quotes around %c in Exec line
    • Pino Toscano: cmake: remove obsolete stuff
    • Pino Toscano: cmake: simplify the various target_link_libraries
    • Luigi Toscano: docs: fix id attribute ( element)
    • Gaël de Chalendar: Corrects bug report #278010 : soversion for kgraphviewerlib was wrong.
    • Gaël de Chalendar: Add the necessary cmake_minimum_required version.
    • T.C. Hollingsworth: docs: restore <(book|article)info>
    • T.C. Hollingsworth: docs: add id attribute to and
      elements
    • Michael Palimaka: Fix build with boost-1.50
    • Jekyll Wu: Fix warnings about wrong base class when opened with Qt Designer
    • Jekyll Wu: Fix missing icons in kgrapheditor
    • Jekyll Wu: Remove the deprecated “Encoding” key
    • Friedrich W. H. Kossebau: Fix kde3 icon name “filequickprint” to “document-print-preview”, seen via lxr
    • Jekyll Wu: Update the name entries in .desktop files
    • Milian Wolff: remove some (but not all) legacy QT3 calls
    • Milian Wolff: properly init m_renderOperationsRevision in default-ctor
    • David Faure: Remove nonsensical call to KGlobal::dirs()->addPrefix(), found via lxr.
    • Milian Wolff: An attribute ID is not allowed for subgraph. But graph in subgraph can have it’s own ID.
    • Milian Wolff: remove obsolete call to setBackgroundMode
    • Milian Wolff: optimize: reuse QPainterPath code from paint method in CanvasEdge
    • Milian Wolff: optimize: cache slow QFontMetrics calculations over paint events
    • Gaël de Chalendar: Add the possibility to export to svg and other pixmap formats
    • Milian Wolff: optimize: interpolate fontwidth and save calls to slow QFontMetrics::width
    • Montel Laurent: Fix forward declaration
    • Montel Laurent: cmakelint
    • Kevin Funk: Fix CMake for non-default graphviz location
    • Gael.deChalendar: - default background color set to white; - default background changed is immediatly taken into account
    • Gael.deChalendar: Correct default background color (change from black to light gray)
    • Pino Toscano: i18n fixes
  • » Kate/KDevelop Sprint 2014: Let There Be Clang

    Mon, 02/03/2014 - 23:58

    Time flies… The extremely productive hack sprint at the friendly Blue Systems office in Barcelona is over for more than a week. I haven’t had time to blog about the last days yet which I hereby make good for!

    I spent a lot of time at the sprint polishing the KDevelop Clang plugin. A up-to-now semi-secretly developed language plugin based on clang which will replace our current C++ language support in KDevelop in the long-run.