mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Ported Scanner2SpeedTest to DOMScanner
This commit is contained in:
parent
22033c0504
commit
b11692f3de
3 changed files with 46 additions and 11 deletions
|
@ -64,7 +64,7 @@ public class PreprocessorSpeedTest {
|
||||||
"#include <iostream>\n";
|
"#include <iostream>\n";
|
||||||
|
|
||||||
CodeReader reader = new CodeReader(code.toCharArray());
|
CodeReader reader = new CodeReader(code.toCharArray());
|
||||||
IScannerInfo info = msvcScannerInfo();
|
IScannerInfo info = getScannerInfo();
|
||||||
long totalTime = 0;
|
long totalTime = 0;
|
||||||
for (int i = 0; i < n; ++i) {
|
for (int i = 0; i < n; ++i) {
|
||||||
long time = testScan(reader, false, info, ParserLanguage.CPP);
|
long time = testScan(reader, false, info, ParserLanguage.CPP);
|
||||||
|
@ -111,7 +111,34 @@ public class PreprocessorSpeedTest {
|
||||||
return totalTime;
|
return totalTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IScannerInfo msvcScannerInfo() {
|
protected IScannerInfo getScannerInfo() {
|
||||||
|
String config = System.getProperty("speedTest.config");
|
||||||
|
|
||||||
|
if (config == null)
|
||||||
|
return mingwScannerInfo();
|
||||||
|
|
||||||
|
if (config.equals("msvc"))
|
||||||
|
return msvcScannerInfo();
|
||||||
|
else if (config.equals("msvc98"))
|
||||||
|
return msvc98ScannerInfo();
|
||||||
|
else if (config.equals("ydl"))
|
||||||
|
return ydlScannerInfo();
|
||||||
|
else
|
||||||
|
return mingwScannerInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
private IScannerInfo msvcScannerInfo() {
|
||||||
|
Map definitions = new Hashtable();
|
||||||
|
//definitions.put( "__GNUC__", "3" ); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
|
String [] includePaths = new String[] {
|
||||||
|
"C:\\Program Files\\Microsoft SDK\\Include",
|
||||||
|
"C:\\Program Files\\Microsoft Visual C++ Toolkit 2003\\include"
|
||||||
|
};
|
||||||
|
return new ScannerInfo( definitions, includePaths );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IScannerInfo msvc98ScannerInfo() {
|
||||||
Map definitions = new Hashtable();
|
Map definitions = new Hashtable();
|
||||||
String [] includePaths = new String[] {
|
String [] includePaths = new String[] {
|
||||||
"C:\\Program Files\\Microsoft Visual Studio\\VC98\\Include"
|
"C:\\Program Files\\Microsoft Visual Studio\\VC98\\Include"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005 IBM Corporation and others.
|
* Copyright (c) 2005, 2007 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,13 +7,8 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
/*
|
|
||||||
* Created on Jun 8, 2004
|
|
||||||
*
|
|
||||||
* TODO To change the template for this generated file go to
|
|
||||||
* Window - Preferences - Java - Code Style - Code Templates
|
|
||||||
*/
|
|
||||||
package org.eclipse.cdt.core.parser.tests.scanner2;
|
package org.eclipse.cdt.core.parser.tests.scanner2;
|
||||||
|
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
@ -36,7 +31,7 @@ import org.eclipse.cdt.internal.core.parser.scanner2.DOMScanner;
|
||||||
* TODO To change the template for this generated type comment go to
|
* TODO To change the template for this generated type comment go to
|
||||||
* Window - Preferences - Java - Code Style - Code Templates
|
* Window - Preferences - Java - Code Style - Code Templates
|
||||||
*/
|
*/
|
||||||
public class Scanner2SpeedTest extends SpeedTest2 {
|
public class DOMScannerSpeedTest extends SpeedTest2 {
|
||||||
|
|
||||||
private static final ISourceElementRequestor CALLBACK = new NullSourceElementRequestor();
|
private static final ISourceElementRequestor CALLBACK = new NullSourceElementRequestor();
|
||||||
private PrintStream stream;
|
private PrintStream stream;
|
||||||
|
@ -47,7 +42,7 @@ public class Scanner2SpeedTest extends SpeedTest2 {
|
||||||
if (args.length > 0)
|
if (args.length > 0)
|
||||||
stream = new PrintStream(new FileOutputStream(args[0]));
|
stream = new PrintStream(new FileOutputStream(args[0]));
|
||||||
|
|
||||||
new Scanner2SpeedTest().runTest(stream, 1);
|
new DOMScannerSpeedTest().runTest(stream, 30);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println(e);
|
System.out.println(e);
|
||||||
}
|
}
|
|
@ -116,6 +116,8 @@ public class SpeedTest2 extends TestCase {
|
||||||
|
|
||||||
if (config.equals("msvc"))
|
if (config.equals("msvc"))
|
||||||
return msvcScannerInfo(false);
|
return msvcScannerInfo(false);
|
||||||
|
else if (config.equals("msvc98"))
|
||||||
|
return msvc98ScannerInfo(false);
|
||||||
else if (config.equals("ydl"))
|
else if (config.equals("ydl"))
|
||||||
return ydlScannerInfo(false);
|
return ydlScannerInfo(false);
|
||||||
else
|
else
|
||||||
|
@ -137,6 +139,17 @@ public class SpeedTest2 extends TestCase {
|
||||||
return new ScannerInfo( definitions, includePaths );
|
return new ScannerInfo( definitions, includePaths );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IScannerInfo msvc98ScannerInfo(boolean quick) {
|
||||||
|
if( quick )
|
||||||
|
return new ScannerInfo();
|
||||||
|
Map definitions = new Hashtable();
|
||||||
|
|
||||||
|
String [] includePaths = new String[] {
|
||||||
|
"C:\\Program Files\\Microsoft Visual Studio\\VC98\\Include"
|
||||||
|
};
|
||||||
|
return new ScannerInfo( definitions, includePaths );
|
||||||
|
}
|
||||||
|
|
||||||
private IScannerInfo mingwScannerInfo(boolean quick) {
|
private IScannerInfo mingwScannerInfo(boolean quick) {
|
||||||
// TODO It would be easier and more flexible if we used discovery for this
|
// TODO It would be easier and more flexible if we used discovery for this
|
||||||
if( quick )
|
if( quick )
|
||||||
|
|
Loading…
Add table
Reference in a new issue