Permalink
Browse files

Adding a basic perf set for testing the parser

This is pretty basic and will generate logs for each individual test - drilling
them down like this let's me help get at particular parts being executed like
the date or structured data. I'll eventually make a helper to collate and
display the data...
  • Loading branch information...
1 parent cbae110 commit f195ece73a39f3387f7b80a49d1cf3cea5625de5 @squeeks committed Nov 28, 2011
Showing with 87 additions and 0 deletions.
  1. +20 −0 perf/parse-all.js
  2. +8 −0 perf/parse-bsd.js
  3. +8 −0 perf/parse-msg.js
  4. +8 −0 perf/parse-sd.js
  5. +8 −0 perf/parse-sdmsg.js
  6. +8 −0 perf/parse-ssign.js
  7. +8 −0 perf/parse-ssigncert.js
  8. +19 −0 perf/run_bench.sh
View
@@ -0,0 +1,20 @@
+var syslogParser = require('../lib/glossy/parse.js');
+
+var messages = [
+ "<165>1 2003-08-24T05:14:15.000003-07:00 192.0.2.1 myproc 8710 - - %% It's time to make the do-nuts.",
+ '<165>1 2003-10-11T22:14:15.003Z mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut="3" eventSource= "Application" eventID="1011"] BOMAn application event log entry...',
+ '<165>1 2003-10-11T22:14:15.003Z mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut="3" eventSource= "Application" eventID="1011"][examplePriority@32473 class="high"] ',
+ "<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - BOM'su root' failed for lonvick on /dev/pts/8",
+ "<13>Feb 5 17:32:18 10.0.0.99 Use the BFG!",
+ "<34>Oct 11 22:14:15 mymachine su: 'su root' failed for lonvick on /dev/pts/8",
+ '<110>1 2009-05-03T14:00:39.519307+02:00 host.example.org syslogd 2138 - [ssign-cert VER="0111" RSID="1" SG="0" SPRI="0" TPBL="587" INDEX="1" FLEN="587" FRAG="2009-05-03T14:00:39.519005+02:00 K BACsLMZ NCV2NUAwe4RAeAnSQuvv2KS51SnHFAaWJNU2XVDYvW1LjmJgg4vKvQPo3HEOD+2hEkt1zcXADe03u5pmHoWy5FGiyCbglYxJkUJJrQqlTSS6vID9yhsmEnh07w3pOsxmb4qYo0uWQrAAenBweVMlBgV3ZA5IMA8xq8l+i8wCgkWJjCjfLar7s+0X3HVrRroyARv8EAIYoxofh9m N8n821BTTuQnz5hp40d6Z3UudKePu2di5Mx3GFelwnV0Qh5mSs0YkuHJg0mcXyUAoeYry5X6482fUxbm+gOHVmYSDtBmZEB8PTEt8Os8aedWgKEt/E4dT+Hmod4omECLteLXxtScTMgDXyC+bSBMjRRCaeWhHrYYdYBACCWMdTc12hRLJTn8LX99kv1I7qwgieyna8GCJv/rEgC ssS9E1qARM+h19KovIUOhl4VzBw3rK7v8Dlw/CJyYDd5kwSvCwjhO21LiReeS90VPYuZFRC1B82Sub152zOqIcAWsgd4myCCiZbWBsuJ8P0gtarFIpleNacCc6OV3i2Rg==" SIGN="AKAQEUiQptgpd0lKcXbuggGXH/dCdQCgdysrTBLUlbeGAQ4vwrnLOqSL7+c="]',
+ '<110>1 2009-05-03T14:00:39.529966+02:00 host.example.org syslogd 2138 - [ssign VER="0111" RSID="1" SG="0" SPRI="0" GBC="2" FMN="1" CNT="7" HB="K6wzcombEvKJ+UTMcn9bPryAeaU= zrkDcIeaDluypaPCY8WWzwHpPok= zgrWOdpx16ADc7UmckyIFY53icE= XfopJ+S8/hODapiBBCgVQaLqBKg= J67gKMFl/OauTC20ibbydwIlJC8= M5GziVgB6KPY3ERU1HXdSi2vtdw= Wxd/lU7uG/ipEYT9xeqnsfohyH0=" SIGN="AKBbX4J7QkrwuwdbV7Taujk2lvOf8gCgC62We1QYfnrNHz7FzAvdySuMyfM="]'
+];
+
+for(var i = 0; i<10000; i++) {
+
+ for(message in messages) {
+ parsed = syslogParser.parse(messages[message]);
+ };
+}
+
View
@@ -0,0 +1,8 @@
+var syslogParser = require('../lib/glossy/parse.js');
+
+var message = "<34>Oct 11 22:14:15 mymachine su: 'su root' failed for lonvick on /dev/pts/8";
+
+for(var i = 0; i<10000; i++) {
+ syslogParser.parse(message);
+}
+
View
@@ -0,0 +1,8 @@
+var syslogParser = require('../lib/glossy/parse.js');
+
+var message = "<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - BOM'su root' failed for lonvick on /dev/pts/8";
+
+for(var i = 0; i<10000; i++) {
+ syslogParser.parse(message);
+}
+
View
@@ -0,0 +1,8 @@
+var syslogParser = require('../lib/glossy/parse.js');
+
+var message = '<165>1 2003-10-11T22:14:15.003Z mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut="3" eventSource= "Application" eventID="1011"][examplePriority@32473 class="high"]';
+
+for(var i = 0; i<10000; i++) {
+ syslogParser.parse(message);
+}
+
View
@@ -0,0 +1,8 @@
+var syslogParser = require('../lib/glossy/parse.js');
+
+var message = '<165>1 2003-10-11T22:14:15.003Z mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut="3" eventSource= "Application" eventID="1011"] BOMAn application event log entry...';
+
+for(var i = 0; i<10000; i++) {
+ syslogParser.parse(message);
+}
+
View
@@ -0,0 +1,8 @@
+var syslogParser = require('../lib/glossy/parse.js');
+
+var message = '<110>1 2009-05-03T14:00:39.529966+02:00 host.example.org syslogd 2138 - [ssign VER="0111" RSID="1" SG="0" SPRI="0" GBC="2" FMN="1" CNT="7" HB="K6wzcombEvKJ+UTMcn9bPryAeaU= zrkDcIeaDluypaPCY8WWzwHpPok= zgrWOdpx16ADc7UmckyIFY53icE= XfopJ+S8/hODapiBBCgVQaLqBKg= J67gKMFl/OauTC20ibbydwIlJC8= M5GziVgB6KPY3ERU1HXdSi2vtdw= Wxd/lU7uG/ipEYT9xeqnsfohyH0=" SIGN="AKBbX4J7QkrwuwdbV7Taujk2lvOf8gCgC62We1QYfnrNHz7FzAvdySuMyfM="]';
+
+for(var i = 0; i<10000; i++) {
+ syslogParser.parse(message);
+}
+
@@ -0,0 +1,8 @@
+var syslogParser = require('../lib/glossy/parse.js');
+
+var message = '<110>1 2009-05-03T14:00:39.519307+02:00 host.example.org syslogd 2138 - [ssign-cert VER="0111" RSID="1" SG="0" SPRI="0" TPBL="587" INDEX="1" FLEN="587" FRAG="2009-05-03T14:00:39.519005+02:00 K BACsLMZ NCV2NUAwe4RAeAnSQuvv2KS51SnHFAaWJNU2XVDYvW1LjmJgg4vKvQPo3HEOD+2hEkt1zcXADe03u5pmHoWy5FGiyCbglYxJkUJJrQqlTSS6vID9yhsmEnh07w3pOsxmb4qYo0uWQrAAenBweVMlBgV3ZA5IMA8xq8l+i8wCgkWJjCjfLar7s+0X3HVrRroyARv8EAIYoxofh9m N8n821BTTuQnz5hp40d6Z3UudKePu2di5Mx3GFelwnV0Qh5mSs0YkuHJg0mcXyUAoeYry5X6482fUxbm+gOHVmYSDtBmZEB8PTEt8Os8aedWgKEt/E4dT+Hmod4omECLteLXxtScTMgDXyC+bSBMjRRCaeWhHrYYdYBACCWMdTc12hRLJTn8LX99kv1I7qwgieyna8GCJv/rEgC ssS9E1qARM+h19KovIUOhl4VzBw3rK7v8Dlw/CJyYDd5kwSvCwjhO21LiReeS90VPYuZFRC1B82Sub152zOqIcAWsgd4myCCiZbWBsuJ8P0gtarFIpleNacCc6OV3i2Rg==" SIGN="AKAQEUiQptgpd0lKcXbuggGXH/dCdQCgdysrTBLUlbeGAQ4vwrnLOqSL7+c="]';
+
+for(var i = 0; i<10000; i++) {
+ syslogParser.parse(message);
+}
+
View
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+FILES=./*.js;
+NODE_BIN=`/usr/bin/which node`;
+GIT_BIN=`/usr/bin/which git`;
+NODE_BIN="${NODE_BIN%\\n}";
+
+if [ ! $NODE_BIN ];
+then
+ echo "node doesn't appear to be in your PATH, exiting...";
+ exit 1;
+fi
+
+for f in $FILES
+do
+ `$NODE_BIN --prof $f`;
+ LOGFILE="${f%.js}"
+ `/bin/mv v8.log $LOGFILE.log`
+done

0 comments on commit f195ece

Please sign in to comment.