blob: f9a8402dd13f4e77301bbaa9c1e837b3d7311ed3 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
******************************************************************************/
package org.eclipse.ui.tests.performance;
import org.eclipse.test.performance.Dimension;
import org.eclipse.ui.activities.IActivityManager;
/**
* @since 3.1
*
*/
public class GenerateIdentifiersTest extends BasicPerformanceTest {
private int count;
public GenerateIdentifiersTest(int numberOfIdentifiers) {
super("Generate " + numberOfIdentifiers + " identifiers", BasicPerformanceTest.LOCAL);
this.count = numberOfIdentifiers;
}
protected void runTest() throws Throwable {
final IActivityManager activityManager = fWorkbench.getActivitySupport().getActivityManager();
tagIfNecessary("UI - Generate Identifiers", Dimension.ELAPSED_PROCESS);
exercise(new TestRunnable() {
public void run() throws Exception {
// construct the Identifiers to test
final String [] ids = new String[count];
for (int i = 0; i < ids.length; i++) {
long timestamp = System.currentTimeMillis();
ids[i] = "org.eclipse.jdt.ui/" + i + timestamp;
}
startMeasuring();
for(int i = 0; i < ids.length; i++) {
activityManager.getIdentifier(ids[i]);
}
stopMeasuring();
}
});
commitMeasurements();
assertPerformance();
}
}