- Timestamp:
- Feb 15, 2014, 2:36:05 AM (11 years ago)
- Location:
- XmlTools2/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
XmlTools2/trunk/readme.txt
r952 r958 1 1 Readme.txt 2 2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 XmlTools v2.0 3 XmlTools v2.0a 4 4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5 5 … … 62 62 Change Log: 63 63 ---------------------------------- 64 2.0a, 15-02-2014 65 -Added multithreading support for @CUSTOM_COMMAND, use wildcards in multiple files for the same js code to 66 take advantage of this (performance may increase over 2.5 times) 67 -Now a warning is given if a user javascript code (@CUSTOM_COMMAND) takes too much time to finish 68 -Fixed small bug when applying patches with @COMMAND + --no-verbose where some std output should not be displayed 69 ---------------------------------- 64 70 2.0, 08-02-2014 65 71 -Rewrite XmlTools fom the scratch from C# to C++ in order to increase (much!) the performance of the program -
XmlTools2/trunk/util.cpp
r942 r958 8 8 QString AppExecutable="./"+AppName; // Mac OS needs unix like executing 9 9 #endif 10 QString AppVersion="2.0 ";10 QString AppVersion="2.0a"; 11 11 } 12 12 -
XmlTools2/trunk/xmlpatch.cpp
r956 r958 245 245 QScriptEngine engine; 246 246 QScriptValue engineResult; // variable to check for js_errors 247 double elapsed_secs; // elapsed seconds that a user script took 248 clock_t begin; // seconds that a script started 247 249 248 250 // Add echo function so user can debug the code … … 269 271 engine.globalObject().setProperty("$xmlData",currXmlFileString); 270 272 273 if(this->verboseEnabled){ 274 begin = clock(); 275 } 276 271 277 // main needs to be called so the user code is evaluated 278 // alternatively you can do: myFunc=engine.evaluate('(function main(){})'); myFunc.call(); 279 // Note the () around the function 272 280 engineResult=engine.evaluate("main(); function main() {"+jsString+"}"); // main funtion allows to use return to exit prematurely from user code 281 282 if(this->verboseEnabled){ 283 elapsed_secs = double(clock() - begin) / CLOCKS_PER_SEC; 284 285 // Warn the user if the script took much time 286 if(elapsed_secs>SLOW_SCRIPT_TIME){ 287 std::cout << "Warning: Slow javascript code detected.\n" << 288 "Warning: Script execution seconds: " << elapsed_secs 289 << std::endl; 290 } 291 } 273 292 274 293 if (engine.hasUncaughtException()) { … … 433 452 // Add --no-backups and --no-verbose if patch was called with that arguments 434 453 if(!this->backupsEnabled){ 435 command.append(" --no-backups ");454 command.append(" --no-backups "); 436 455 } 437 456 438 457 if(!this->verboseEnabled){ 439 command.append(" --no-verbose ");458 command.append(" --no-verbose "); 440 459 } 441 460 -
XmlTools2/trunk/xmlpatch.h
r956 r958 5 5 #include "optionsparser.h" 6 6 #include <omp.h> // OpenMP support 7 #include <ctime> // script execution time calculation 8 9 #define SLOW_SCRIPT_TIME 0.1 // if a user script takes more than 0.1 seconds to execute give a warning. 7 10 8 11 class XmlPatch
Note:
See TracChangeset
for help on using the changeset viewer.