Ejemplo n.º 1
0
    def render_data(self):
        """
        add the event rectangles
        """
        if not self.window_ready:
            # update() is called a couple of times during init()
            return

        _rs = self.render_start.get()
        _rc = self.render_cutoff.get()
        _sc = self.scale.get()

        event_count = len(self.data) - 1
        shown = 0
        for n, event in enumerate(self.data):
            if n % 1000 == 0 or n == event_count:
                self.set_status("Rendered %d events (%d%%)" % (n, float(n) * 100 / event_count))
                self.master.update()
            thread_idx = event.thread_id

            if event.start_type == "START":
                if (event.end_time - event.start_time) * 1000 < _rc:
                    continue
                if event.depth >= MAX_DEPTH:
                    continue
                shown += 1
                if shown == 500 and VERSION.endswith("-demo"):
                    showerror("Demo Limit", "The evaluation build is limited to showing 500 events at a time, so rendering has stopped")
                    break
                self.show_event(
                    event, _rs, _sc,
                    thread_idx,
                )

            elif event.start_type == "BMARK":
                # note that when loading data, we currently filter for
                # "start_type=START" for a massive indexed speed boost
                # so there are no bookmarks. We may want to load bookmarks
                # into a separate array?
                pass  # render bookmark

            elif event.start_type == "LOCKW" or event.start_type == "LOCKA":
                self.show_lock(
                    event, _rs, _sc,
                    thread_idx,
                )

        self.set_status("")
Ejemplo n.º 2
0
from context.viewer.cbtk import set_icon, win_center
from context.viewer.util import conditional, gen_colour, shrink
import context.viewer.data as data


NAME = "Context"
MAX_DEPTH = 7
BLOCK_HEIGHT = 20
HEADER_HEIGHT = 20
SCRUBBER_HEIGHT = 20
MIN_PPS = 1
MAX_PPS = 5000
MIN_SEC = 1
MAX_SEC = 600

if VERSION.endswith("-demo"):
    NAME += ": Non-commercial / Evaluation Version"

os.environ["PATH"] = os.environ.get("PATH", "") + ":%s" % os.path.dirname(sys.argv[0])


def version_check(fn):
    c = sqlite3.connect(fn)
    ok = False

    try:
        ok = c.execute("SELECT version FROM settings LIMIT 1").fetchone()[0] == 1
    except Exception:
        ok = False

    c.close()