Archive for January, 2011

Screencast: Zeitgeist Development – Part I

This is the first episode of my very first screencast series on “Zeitgeist Development”. It’s about writing a simple extension which helps me to analyse memory¬†consumption¬†of the daemon.

Let’s have a quick look at both files created as part of the extension:

mem_profiler.py

import dbus
import dbus.service
import tempfile

from meliae import scanner

from _zeitgeist.engine.extension import Extension
from _zeitgeist.engine import constants

PATH = "/org/gnome/zeitgeist/memory_profiler"

class MemoryProfiler(Extension, dbus.service.Object):
    
    def __init__(self, engine):
        Extension.__init__(self, engine)
        dbus.service.Object.__init__(
            self, dbus.SessionBus(), PATH
        )
        
    @dbus.service.method(constants.DBUS_INTERFACE, out_signature="s")
    def MakeSnapShot(self):
        filename = tempfile.mktemp(suffix=".json")
        scanner.dump_all_objects(filename)
        return filename

setup.py

from distutils.core import setup

setup(
    name="zeitgeist-memory-profiler",
    version="0.1",
    data_files=(
        ("share/zeitgeist/extensions", ["mem_profiler.py",]),
    )
)

That’s it for the first episode, next video will be on analysing the data we get from meliae.

Update: uploaded a new version, with hopefully less blur and better quality, still learning how to use youtube.

Advertisements

Leave a comment