Package com.google.speedtracer.latencydashboard.shared

Examples of com.google.speedtracer.latencydashboard.shared.CustomDashboardRecord


    String unitTestName = "UnitTest-testPut";
    DatastoreService store = DatastoreServiceFactory.getDatastoreService();
    CustomDashboardRecordStore.clear(store, unitTestName);

    long now = System.currentTimeMillis();
    CustomDashboardRecord record = new CustomDashboardRecord(now, unitTestName,
        "r1");
    record.addCustomMeasure("measure_one", 100.0);
    record.addCustomMeasure("measure two", 1000.0);
    CustomDashboardRecordStore.put(
        DatastoreServiceFactory.getDatastoreService(), record);

    Iterator<CustomDashboardRecord> results = CustomDashboardRecordStore.getLatest(
        store, 100);

    CustomDashboardRecord found = null;
    while (results.hasNext()) {
      CustomDashboardRecord result = results.next();
      String foundName = result.getName();
      long foundTimeStamp = result.getTimestamp();
      if (foundName.equals(unitTestName) && foundTimeStamp == now) {
        found = result;
        break;
      }
    }
View Full Code Here


  public CustomDashboardRecord[] getCustomDashboardLatestRecords(int n) {
    Iterator<CustomDashboardRecord> origResults = CustomDashboardRecordStore.getLatest(
        DatastoreServiceFactory.getDatastoreService(), n);
    List<CustomDashboardRecord> listResults = new ArrayList<CustomDashboardRecord>();
    while (origResults.hasNext()) {
      CustomDashboardRecord item = origResults.next();
      listResults.add(item);
    }
    // Copy the list into an array to pass over RPC
    CustomDashboardRecord arrayResults[] = null;
    arrayResults = listResults.toArray(new CustomDashboardRecord[listResults.size()]);

    return arrayResults;
  }
View Full Code Here

    } catch (JsonException ex) {
      System.err.println("Malformed Json passed to processForDashboards: " + ex);
      ex.printStackTrace();
    }

    CustomDashboardRecord customRecord = null;
    try {
      customRecord = processCustomForDashBoard(analyzer, speedTraceRecord);
    } catch (JsonException ex) {
      System.err.println("Malformed Json passed to custom processForDashboards: "
          + ex);
      ex.printStackTrace();
    }

    // Store the statistics in the datastore
    if (dashboardRecord != null) {
      DashboardRecordStore.put(DatastoreServiceFactory.getDatastoreService(),
          dashboardRecord);
    }
    if (customRecord != null && customRecord.isValid()) {
      CustomDashboardRecordStore.put(
          DatastoreServiceFactory.getDatastoreService(), customRecord);
    }
  }
View Full Code Here

   * @return
   */
  private CustomDashboardRecord processCustomForDashBoard(
      SpeedTraceAnalyzer analyzer, SpeedTraceRecord speedTraceRecord)
      throws JsonException {
    CustomDashboardRecord customRecord = new CustomDashboardRecord(
        speedTraceRecord.getTimestamp(), speedTraceRecord.getName(),
        speedTraceRecord.getRevision());

    MarkTimelineAnalyzer markTimelineAnalyzer = new MarkTimelineAnalyzer(
        analyzer, MARKTIMELINE_PREFIX);
    markTimelineAnalyzer.registerMeasurementSet("client_load");
    markTimelineAnalyzer.registerMeasurementSet("prefetch_cache_fill");
    markTimelineAnalyzer.registerMeasurementSet("page");
    markTimelineAnalyzer.registerMeasurementSet("digests_search");
    markTimelineAnalyzer.registerMeasurementSet("contact-sort");

    markTimelineAnalyzer.analyze();
    markTimelineAnalyzer.store(customRecord);

    if (customRecord.isValid()) {
      System.out.println("Custom Record: " + customRecord.getFormattedRecord());
    }
    return customRecord;
  }
View Full Code Here

   * @param entity record returned from the persistent store.
   */
  public static CustomDashboardRecord get(Entity entity) {
    Map<String, Object> properties = entity.getProperties();

    CustomDashboardRecord result = new CustomDashboardRecord(
        (Long) properties.get(KEY_PROP_TIMESTAMP),
        (String) properties.get(KEY_PROP_NAME),
        (String) properties.get(KEY_PROP_REVISION));

    for (String key : properties.keySet()) {
      if (key.startsWith(CUSTOM_KEY_PREFIX)) {
        Double data = (Double) properties.get(key);
        String dataLabel = key.substring(CUSTOM_KEY_PREFIX.length());
        result.addCustomMeasure(dataLabel, data);
      }
    }
    return result;
  }
View Full Code Here

TOP

Related Classes of com.google.speedtracer.latencydashboard.shared.CustomDashboardRecord

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.