mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Performance Test for the preprocessor
This commit is contained in:
parent
4466a9e819
commit
73e2035f67
2 changed files with 10 additions and 8 deletions
|
@ -16,6 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.eclipse.cdt.core.parser.tests.scanner2;
|
package org.eclipse.cdt.core.parser.tests.scanner2;
|
||||||
|
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
|
@ -43,10 +44,10 @@ public class Scanner2SpeedTest extends SpeedTest2 {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
PrintStream stream = null;
|
PrintStream stream = null;
|
||||||
// if (args.length > 0)
|
if (args.length > 0)
|
||||||
// stream = new PrintStream(new FileOutputStream("c:/tmp/dom.txt"));
|
stream = new PrintStream(new FileOutputStream(args[0]));
|
||||||
|
|
||||||
new Scanner2SpeedTest().runTest(stream, 30);
|
new Scanner2SpeedTest().runTest(stream, 1);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println(e);
|
System.out.println(e);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +69,7 @@ public class Scanner2SpeedTest extends SpeedTest2 {
|
||||||
"#include <iostream>\n";
|
"#include <iostream>\n";
|
||||||
|
|
||||||
CodeReader reader = new CodeReader(code.toCharArray());
|
CodeReader reader = new CodeReader(code.toCharArray());
|
||||||
IScannerInfo info = msvcScannerInfo(false);
|
IScannerInfo info = getScannerInfo(false);
|
||||||
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);
|
||||||
|
|
|
@ -122,16 +122,17 @@ public class SpeedTest2 extends TestCase {
|
||||||
return mingwScannerInfo(false);
|
return mingwScannerInfo(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IScannerInfo msvcScannerInfo(boolean quick) {
|
private IScannerInfo msvcScannerInfo(boolean quick) {
|
||||||
if( quick )
|
if( quick )
|
||||||
return new ScannerInfo();
|
return new ScannerInfo();
|
||||||
Map definitions = new Hashtable();
|
Map definitions = new Hashtable();
|
||||||
//definitions.put( "__GNUC__", "3" ); //$NON-NLS-1$ //$NON-NLS-2$
|
//definitions.put( "__GNUC__", "3" ); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
String [] includePaths = new String[] {
|
String [] includePaths = new String[] {
|
||||||
"C:\\Program Files\\Microsoft Visual Studio\\VC98\\Include"
|
"C:\\Program Files\\Microsoft SDK\\Include",
|
||||||
// "C:\\Program Files\\Microsoft Platform SDK\\Include",
|
"C:\\Program Files\\Microsoft Visual C++ Toolkit 2003\\include"
|
||||||
// "C:\\Program Files\\Microsoft Visual C++ Toolkit 2003\\include"
|
|
||||||
|
// "C:\\Program Files\\Microsoft Visual Studio\\VC98\\Include"
|
||||||
};
|
};
|
||||||
return new ScannerInfo( definitions, includePaths );
|
return new ScannerInfo( definitions, includePaths );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue