My favorites | Sign in
Logo
                
Search
for
Updated Aug 26, 2009 by larsga
TologTips  
Tips and tricks for using tolog

Introduction

This is a dumping ground for various tips and tricks for using tolog. What's suitable for inclusion should be migrated into the product documentation proper.

tologspy

In cases where Ontopia-based solutions give poor performance it can often be difficult to tell what the source of the problem is. One way to approach it is to do profiling of the tolog queries.

A simple way to do it is to drop this JSP page into the application:

<%@ page language="java" 
           import="net.ontopia.topicmaps.query.utils.TologSpy" %>
<style>th, .event { vertical-align: top; text-align: left } 
td { vertical-align: top; text-align: right }</style>
<%
TologSpy.setIsRecording(true);
TologSpy.generateReport(out);
%>

The first time it is loaded it turns on tolog query profiling (the setIsRecording call). When reloading data will start to appear. Calling setIsRecording(false) will turn profiling off again.

In the future profiling should be a property settable in a properties file.

Note that you do not necessarily need to output the statistics in the HTML page. Instead, you could write it to a file with the following code:

FileWriter myout = new FileWriter("/tmp/stats.html");
TologSpy.generateReport(myout);
myout.close();

Sign in to add a comment
Hosted by Google Code