Package org.eclipse.test.performance

Examples of org.eclipse.test.performance.PerformanceMeter


  }

  @Test
  public void testCreateProject() throws IOException, SAXException, JSONException {
    Performance performance = Performance.getDefault();
    PerformanceMeter meter = performance.createPerformanceMeter("SimpleServerStressTest#testCreateProject");
    //create workspace
    String workspaceName = SimpleServerStressTest.class.getName() + "#testCreateProject";
    createWorkspace(workspaceName);
    final int PROJECT_COUNT = 1000;//increase this value for a real stress test
    meter.start();
    long start = System.currentTimeMillis();
    for (int i = 0; i < PROJECT_COUNT; i++) {
      //create a project
      String projectName = "Project" + i;
      WebRequest request = getCreateProjectRequest(workspaceLocation, projectName, null);
      WebResponse response = webConversation.getResponse(request);
      assertEquals(HttpURLConnection.HTTP_CREATED, response.getResponseCode());
      String locationHeader = response.getHeaderField(ProtocolConstants.HEADER_LOCATION);
      assertNotNull(locationHeader);
      if (i % 500 == 0) {
        long end = System.currentTimeMillis();
        long avg = (end - start) / (i + 1);
        System.out.println("Created project " + i + " average time per project: " + avg);
      }
    }
    meter.stop();
    meter.commit();
  }
View Full Code Here


    sample.tagAsSummary(true, performanceResult.getName(), new Dimension[] {Dimension.CPU_TIME}, 0, null);
    Variations variations = PerformanceTestPlugin.getVariations();
    variations.put("browser", suiteName);
    DB.store(variations, sample);

    PerformanceMeter meter = new InternalPerformanceMeter(scenarioId) {
      public void stop() {
        throw new IllegalStateException();
      }

      public void start() {
View Full Code Here

  public void testCreateUsers() throws IOException, SAXException {
    WebConversation webConversation = new WebConversation();
    webConversation.setExceptionsThrownOnErrorStatus(false);

    Performance performance = Performance.getDefault();
    PerformanceMeter meter = performance.createPerformanceMeter("SimpleServerUserStressTest#testCreateUsers");
    final int USER_COUNT = 10001;
    meter.start();
    long start = System.currentTimeMillis();
    for (int i = 0; i < USER_COUNT; i++) {

      long current_start = System.currentTimeMillis();

      // create a user
      Map<String, String> params = new HashMap<String, String>();
      String login = getRandomName();
      params.put(UserConstants.KEY_LOGIN, login);
      params.put(UserConstants2.FULL_NAME, getRandomName() + " " + getRandomName());
      params.put(UserConstants2.EMAIL, login + "@example.com");
      params.put(UserConstants2.PASSWORD, getRandomName() + System.currentTimeMillis());

      WebRequest request = getPostUsersRequest("", params, true);
      WebResponse response = webConversation.getResponse(request);
      assertEquals(response.getText(), HttpURLConnection.HTTP_OK, response.getResponseCode());

      if (i % 1000 == 0) {
        long end = System.currentTimeMillis();
        long avg = (end - start) / (i + 1);
        long current = end - current_start;
        System.out.println("Created user " + i + " in " + current + "ms, average time per user: " + avg + "ms");
      }
    }
    meter.stop();
    meter.commit();
  }
View Full Code Here

import org.eclipse.test.performance.PerformanceMeter;

public class SimplePerformanceMeterTest extends TestCase {
 
    public void testPerformanceMeterFactory() {
    PerformanceMeter meter= Performance.getDefault().createPerformanceMeter("scenarioId"); //$NON-NLS-1$
   
    assertTrue(meter instanceof OSPerformanceMeter);
 
    meter.start();
    meter.stop();
   
    meter.commit();
   
    meter.dispose();
  }
View Full Code Here

public class PerformanceMeterFactoryTest extends TestCase {

    public void testPerformanceMeterFactory() {
    System.setProperty("PerformanceMeterFactory", "org.eclipse.test.performance:org.eclipse.test.internal.performance.OSPerformanceMeterFactory"); //$NON-NLS-1$ //$NON-NLS-2$
   
    PerformanceMeter pm= Performance.getDefault().createPerformanceMeter("scenarioId"); //$NON-NLS-1$
   
    assertTrue(pm instanceof OSPerformanceMeter);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.test.performance.PerformanceMeter

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.