// Created on: 2004-03-05 // Created by: Mikhail KUZMITCHEV // Copyright (c) 2004-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define PERF_ENABLE_METERS #include #define ItemType gp_Pnt #define Key1Type Standard_Real #define Key2Type Standard_Integer // ===================== INSTANTIATIONS =========== // ===================== The Types must be defined before this line =========== // These are: TheItemType, TheKey1Type, TheKey2Type // So must be defined ::HashCode and ::IsEqual too #include #include ////////////////////////////////DEFINE_ARRAY1(QANCollection_Array1,QANCollection_BaseCol,ItemType) ////////////////////////////////DEFINE_HARRAY1(QANCollection_HArray1,QANCollection_Array1) DEFINE_ARRAY1(QANCollection_Array1Perf,QANCollection_BaseColPerf,ItemType) DEFINE_HARRAY1(QANCollection_HArray1Perf,QANCollection_Array1Perf) #include #include ////////////////////////////////DEFINE_ARRAY2(QANCollection_Array2,QANCollection_BaseCol,ItemType) ////////////////////////////////DEFINE_HARRAY2(QANCollection_HArray2,QANCollection_Array2) DEFINE_ARRAY2(QANCollection_Array2Perf,QANCollection_BaseColPerf,ItemType) DEFINE_HARRAY2(QANCollection_HArray2Perf,QANCollection_Array2Perf) #include #include #include #include #include ////////////////////////////////DEFINE_MAP(QANCollection_Map,QANCollection_Key1BaseCol,Key1Type) ////////////////////////////////DEFINE_DATAMAP(QANCollection_DataMap,QANCollection_BaseCol,Key1Type,ItemType) ////////////////////////////////DEFINE_DOUBLEMAP(QANCollection_DoubleMap,QANCollection_Key2BaseCol,Key1Type,Key2Type) ////////////////////////////////DEFINE_INDEXEDMAP(QANCollection_IndexedMap,QANCollection_Key1BaseCol,Key1Type) ////////////////////////////////DEFINE_INDEXEDDATAMAP(QANCollection_IDMap,QANCollection_BaseCol,Key1Type,ItemType) DEFINE_MAP(QANCollection_MapPerf,QANCollection_Key1BaseColPerf,Key1Type) DEFINE_DATAMAP(QANCollection_DataMapPerf,QANCollection_BaseColPerf,Key1Type,ItemType) DEFINE_DOUBLEMAP(QANCollection_DoubleMapPerf,QANCollection_Key2BaseColPerf,Key1Type,Key2Type) DEFINE_INDEXEDMAP(QANCollection_IndexedMapPerf,QANCollection_Key1BaseColPerf,Key1Type) DEFINE_INDEXEDDATAMAP(QANCollection_IDMapPerf,QANCollection_BaseColPerf,Key1Type,ItemType) #include ////////////////////////////////DEFINE_LIST(QANCollection_List,QANCollection_BaseCol,ItemType) DEFINE_LIST(QANCollection_ListPerf,QANCollection_BaseColPerf,ItemType) #include #include ////////////////////////////////DEFINE_SEQUENCE(QANCollection_Sequence,QANCollection_BaseCol,ItemType) ////////////////////////////////DEFINE_HSEQUENCE(QANCollection_HSequence,QANCollection_Sequence) DEFINE_SEQUENCE(QANCollection_SequencePerf,QANCollection_BaseColPerf,ItemType) DEFINE_HSEQUENCE(QANCollection_HSequencePerf,QANCollection_SequencePerf) static void printAllMeters (Draw_Interpretor& theDI) { char buffer[25600]; perf_sprint_all_meters (buffer, 25600 - 1, 1); theDI << buffer; } // ===================== Test perform of Array1 type ========================== static void CompArray1 (Draw_Interpretor& theDI, const Standard_Integer theRep, const Standard_Integer theSize) { Standard_Integer i,j; ////////////////////////////////Perf_Meter aNCrea ("NCollection_Array1 creation",0); ////////////////////////////////Perf_Meter aTCrea ("TCollection_Array1 creation",0); ////////////////////////////////Perf_Meter aNFill ("NCollection_Array1 filling",0); ////////////////////////////////Perf_Meter aTFill ("TCollection_Array1 filling",0); ////////////////////////////////Perf_Meter aNFind ("NCollection_Array1 finding",0); ////////////////////////////////Perf_Meter aTFind ("TCollection_Array1 finding",0); ////////////////////////////////Perf_Meter aNOper ("NCollection_Array1 operator=",0); ////////////////////////////////Perf_Meter aTOper ("TCollection_Array1 operator=",0); ////////////////////////////////Perf_Meter aNAssi ("NCollection_Array1 Assign",0); for (i=0; i a1(theSize),a2(theSize); PERF_STOP_METER("NCollection_SparseArray creation") PERF_START_METER("NCollection_SparseArray filling") for( j=0;j 0\n"; return 1; } if ( Size < 1 ) { di << "Size > 0\n"; return 1; } return 0; } //======================================================================= //function : QANColPerfArray1 //purpose : //======================================================================= static Standard_Integer QANColPerfArray1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) { Standard_Integer Repeat, Size; if ( CheckArguments(di, argc, argv, Repeat, Size) ) { return 1; } CompArray1 (di, Repeat, Size); return 0; } //======================================================================= //function : QANColPerfArray2 //purpose : //======================================================================= static Standard_Integer QANColPerfArray2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) { Standard_Integer Repeat, Size; if ( CheckArguments(di, argc, argv, Repeat, Size) ) { return 1; } CompArray2 (di, Repeat, Size); return 0; } //======================================================================= //function : QANColPerfList //purpose : //======================================================================= static Standard_Integer QANColPerfList(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) { Standard_Integer Repeat, Size; if ( CheckArguments(di, argc, argv, Repeat, Size) ) { return 1; } CompList (di, Repeat, Size); return 0; } //======================================================================= //function : QANColPerfSequence //purpose : //======================================================================= static Standard_Integer QANColPerfSequence(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) { Standard_Integer Repeat, Size; if ( CheckArguments(di, argc, argv, Repeat, Size) ) { return 1; } CompSequence (di, Repeat, Size); return 0; } //======================================================================= //function : QANColPerfMap //purpose : //======================================================================= static Standard_Integer QANColPerfMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) { Standard_Integer Repeat, Size; if ( CheckArguments(di, argc, argv, Repeat, Size) ) { return 1; } CompMap (di, Repeat, Size); return 0; } //======================================================================= //function : QANColPerfDataMap //purpose : //======================================================================= static Standard_Integer QANColPerfDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) { Standard_Integer Repeat, Size; if ( CheckArguments(di, argc, argv, Repeat, Size) ) { return 1; } CompDataMap (di, Repeat, Size); return 0; } //======================================================================= //function : QANColPerfDoubleMap //purpose : //======================================================================= static Standard_Integer QANColPerfDoubleMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) { Standard_Integer Repeat, Size; if ( CheckArguments(di, argc, argv, Repeat, Size) ) { return 1; } CompDoubleMap (di, Repeat, Size); return 0; } //======================================================================= //function : QANColPerfIndexedMap //purpose : //======================================================================= static Standard_Integer QANColPerfIndexedMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) { Standard_Integer Repeat, Size; if ( CheckArguments(di, argc, argv, Repeat, Size) ) { return 1; } CompIndexedMap (di, Repeat, Size); return 0; } //======================================================================= //function : QANColPerfIndexedDataMap //purpose : //======================================================================= static Standard_Integer QANColPerfIndexedDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) { Standard_Integer Repeat, Size; if ( CheckArguments(di, argc, argv, Repeat, Size) ) { return 1; } CompIndexedDataMap (di, Repeat, Size); return 0; } //======================================================================= //function : QANColCheckSparseArray //purpose : //======================================================================= static Standard_Integer QANColCheckSparseArray(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) { Standard_Integer Repeat, Size; if ( CheckArguments(di, argc, argv, Repeat, Size) ) { return 1; } CompSparseArray (di, Repeat, Size); return 0; } void QANCollection::CommandsPerf(Draw_Interpretor& theCommands) { const char *group = "QANCollection"; // from agvCollTest/src/CollectionEXE/PerfTestEXE.cxx theCommands.Add("QANColPerfArray1", "QANColPerfArray1 Repeat Size", __FILE__, QANColPerfArray1, group); theCommands.Add("QANColPerfArray2", "QANColPerfArray2 Repeat Size", __FILE__, QANColPerfArray2, group); theCommands.Add("QANColPerfList", "QANColPerfList Repeat Size", __FILE__, QANColPerfList, group); theCommands.Add("QANColPerfSequence", "QANColPerfSequence Repeat Size", __FILE__, QANColPerfSequence, group); theCommands.Add("QANColPerfMap", "QANColPerfMap Repeat Size", __FILE__, QANColPerfMap, group); theCommands.Add("QANColPerfDataMap", "QANColPerfDataMap Repeat Size", __FILE__, QANColPerfDataMap, group); theCommands.Add("QANColPerfDoubleMap", "QANColPerfDoubleMap Repeat Size", __FILE__, QANColPerfDoubleMap, group); theCommands.Add("QANColPerfIndexedMap", "QANColPerfIndexedMap Repeat Size", __FILE__, QANColPerfIndexedMap, group); theCommands.Add("QANColPerfIndexedDataMap", "QANColPerfIndexedDataMap Repeat Size", __FILE__, QANColPerfIndexedDataMap, group); theCommands.Add("QANColCheckSparseArray", "QANColCheckSparseArray Repeat Size", __FILE__, QANColCheckSparseArray, group); return; }