예제 #1
0
 public String createQuery(Set<String> individuals, String aboxfilter) {
   Monitor monABoxQueryGeneration = MonitorFactory.getTimeMonitor("ABox query generator").start();
   StringBuilder builder = new StringBuilder();
   builder.append("PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n");
   builder.append("CONSTRUCT {?s ?p ?o  } ");
   builder.append("{ ?s ?p ?o . ");
   builder.append(makeInFilter("?s", individuals));
   if (aboxfilter != null) {
     builder.append(aboxfilter);
   }
   builder.append("FILTER ( (?p!=rdf:type))");
   builder.append("}");
   monABoxQueryGeneration.stop();
   return builder.toString();
 }
예제 #2
0
  public static void main(String[] args) {

    Monitor timer = MonitorFactory.start("totaltime");
    for (int i = 1; i <= 10; i++) {
      System.out.println(MonitorFactory.add("NIC.bytes.sent", "bytes", i * 1000));
      System.out.println(MonitorFactory.add("negativetest", "neg", -1000.0 * i));
    }

    System.out.println("");
    Monitor m = null;
    m = MonitorFactory.start("purchasesTimeTestNoRange");

    for (int i = 1; i <= 1000000; i++) MonitorFactory.add("purchasesNoRange", "dollars", 1000.0);

    System.out.println("purchasesTimeTestNoRange=" + m.stop().getTotal());

    m = MonitorFactory.start("testTimerTimeTest");
    for (int i = 1; i <= 1000000; i++) MonitorFactory.start("testTimer").stop();

    System.out.println("testTimerTimeTest=" + m.stop().getTotal());
    for (int i = -5; i <= 20; i++) {
      MonitorFactory.add("purchases", "dollars", i * 50);
    }

    System.out.println("");

    System.out.println(MonitorFactory.add("NIC.bytes.received", "bytes", 250.0));
    System.out.println(MonitorFactory.add("NIC.bytes.received", "bytes", 250.0));

    timer.stop();

    for (int i = -5; i < 25; i++) MonitorFactory.add("timetest", "ms.", i * 5);

    System.out.println(MonitorFactory.getMonitor("purchases", "dollars").getHits());
    System.out.println(MonitorFactory.getTimeMonitor("testTimer").getHits());
    // case sensitive so won't print
    System.out.println(MonitorFactory.getTimeMonitor("testtimer").getHits());
    System.out.println("Total time=" + timer.getTotal());

    MonitorFactory.reset();
    MonitorFactory.setRangeDefault("dollars", getTestHolder());
    m = MonitorFactory.start("purchasesTimeTestRange");
    for (int i = 1; i <= 1000000; i++) MonitorFactory.add("purchasesRange", "dollars", 1000.0);

    System.out.println("purchasesTimeTestRange=" + m.stop().getTotal());
    Object[][] data = null;
    MonitorFactory.setRangeDefault("bytes", getTestHolder());
    MonitorFactory.setRangeDefault("cents", getTestHolder());
    MonitorFactory.setRangeDefault("minutes", getTestHolder());
    MonitorFactory.setRangeDefault("MB", getTestHolder());
    MonitorFactory.setRangeDefault("KB", getTestHolder());
    MonitorFactory.setRangeDefault("points", getTestHolder());

    String[] header = MonitorFactory.getComposite("ms.").getHeader();

    data = MonitorFactory.getComposite("ms.").getData();
    header = MonitorFactory.getComposite("ms.").getBasicHeader();

    data = MonitorFactory.getComposite("ms.").getBasicData();
    header = MonitorFactory.getComposite("ms.").getDisplayHeader();

    data = MonitorFactory.getComposite("ms.").getDisplayData();
    MonitorFactory.getComposite("ms.").disable();

    header = MonitorFactory.getComposite("ms.").getHeader();
    data = MonitorFactory.getComposite("ms.").getData();

    System.out.println("header length=" + header.length + ", data length=" + data.length);
    System.out.println("JAMon Version=" + MonitorFactory.getVersion());
  }