KDE TechBase
  • Page
  • Discussion
  • Edit
  • History
KDE TechBase is a Wiki - You can help! Please contribute! Questions?
Please ask development related questions in the KDE Community Forum.

Projects/PIM/Akonadi/Development Tools

< Projects | PIM | Akonadi

Contents

  • 1 Akonadi Developer Tools
    • 1.1 Akonadi Console
      • 1.1.1 Managing Agents
      • 1.1.2 Collections and Items
      • 1.1.3 Monitoring Akonadi Communication
      • 1.1.4 Access to the Server Database
  • 2 Debugging Akonadi Agents
    • 2.1 Attaching gdb at startup
    • 2.2 Running an agent in valgrind
  • 3 Akonadi Testing and Benchmark Infrastructure

[edit] Akonadi Developer Tools

[edit] Akonadi Console

Akonadi Console is a tool for developers working with Akonadi or on Akonadi itself.

It provides GUI for

  • managing agents and resources
  • retrieving, checking and even manipulating data
  • monitoring communication between Akonadi server and its clients
  • convenience access to the database used by the server

[edit] Managing Agents

Image:AkonadiConsoleTabAgents.png

This facility is basically a GUI for Akonadi::AgentManager and Akonadi::AgentInstance.

It enables the developer to quickly add or remove agents from the currently running Akonadi system, to check an agent's basic properties and status, etc.

While most of these actions can also be performed through end user GUI, e.g. KDE's Systemsettings, this is usually quicker and it provides more detailed information.


Tip
noframe
The Synchronize action menu can be used to just synchronize the collection tree, basically a convenient way for a resource developer to call just the retrieveCollections() method.


[edit] Collections and Items

Image:AkonadiConsoleTabBrowser.png

This facility shows all Akonadi collections, how they are organized as a tree and their items and enables the developer to perform actions on these entities.

Developers working on agents can use this perform the most common tasks such as

  • retrieving items: see the context menu of collection entries, basically a call to the respective resource's retrieveItems() method
  • retrieve item payloads: either by clicking on an item or, for certain type such as contacts by switching the item view's mode to the respective data type.
  • copy and delete items: see the context menu of item entries
  • modify items: e.g. by changing the serialized form of the item on the Raw Payload tab

without having to go through an end user application.

Developers working on end user applications can use this to simulate respective changes by other clients and to check whether changes done by the application itself are correctly applied to the shared data.


Tip
noframe
If a newly added resource's collections do not show up in the collection tree, it might be necessary to explicitly synchronize it. This functionality is available on the Agents tab.

}

[edit] Monitoring Akonadi Communication

Image:AkonadiConsoleTabDebugger.png

This facility allows to monitor the Akonadi data protocol based communication between client sessions and the server. It contains commands, responses and the data transported between the two sides.


Note
noframe
Since this can slow down operations it is disabled by default and has to be enabled manually when needed.


[edit] Access to the Server Database

Akonadi uses a SQL database for keeping relations such as which collection an item is in, properties such as MIME types, etc. as well as cached item payload data.

Since this is quite internal to the Akonadi server, it will most likely only be interesting to people working on Akonadi, not for developers working with Akonadi.

Image:AkonadiConsoleTabDBBrowser.png

The database browser can query and display the database tables used by Akonadi.

Image:AkonadiConsoleDBConsole.png

The database console enables developers to directly send commands to the database engine.

[edit] Debugging Akonadi Agents

Agents are automatically started by the Akonadi server and thus are not debugable from the start on by the usual methods. A similar problem is known from KIO slaves, the solution is similar as well.

[edit] Attaching gdb at startup

Export the environment variable AKONADI_DEBUG_WAIT and put the agent type in there you want to debug. You only need to specify a part of the agent type, not the whole one. Example:

export AKONADI_DEBUG_WAIT=knut

When starting an agent of this type, you'll see the following debug output by the Akonadi server which is pretty much self-explanatory.

============================================================
ProcessControl: Suspending process akonadi_knut_resouce
'gdb -pid 1234' to debug
'kill -SIGCONT 1234' to continue
============================================================

[edit] Running an agent in valgrind

Running an agent in valgrind is done in a similar way, you need to export AKONADI_VALGRIND and put the agent type in there.

To specify the valgrind tool to use by exporting AKONADI_VALGRIND_SKIN, the default is memcheck.

Additional config options can be given using AKONADI_VALGRIND_OPTIONS.

Example:

valgrind akonadi_vcard_resource using memcheck:

export AKONADI_VALGRIND=akonadi_vcard_resource

Profile the vcard resource using callgrind, disabling instrumentation on start for faster startup, and dumping the callgrind output to a custom file:

export AKONADI_VALGRIND=akonadi_vcard_resource
export AKONADI_VALGRIND_SKIN=callgrind
export AKONADI_VALGRIND_OPTIONS="--instr-atstart=no --callgrind-out-file=$HOME/callgrind-vcard.%p"

[edit] Akonadi Testing and Benchmark Infrastructure

The Akonadi Test project provides tools to run Akonadi tests in self-contained environments, i.e. separated from the developer's personal setup, as well as running automated tests, e.g. as part of a unit test suite.

Retrieved from "http://techbase.kde.org/Projects/PIM/Akonadi/Development_Tools"
Category: PIM

Navigation

  • Home
  • Help
  • Recent changes

Sections

  • Getting started
  • Development
  • Schedules
  • Policies
  • Contribute
  • Projects

Toolbox

  • What links here
  • Related changes
  • Special pages
  • Printable version
  • Permanent link

Personal tools

  • 38.107.191.95
  • Talk for this IP
  • Log in / create account
  • Login with OpenID
Creative Commons License SA 3.0 as well as the GNU Free Documentation License 1.2
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal