50 template<
class JType_t>
51 int do_main(
int argc,
char **argv,
const char* title)
63 JParser<> zap(
"Auxiliary program to test speed of memory allocation.");
73 catch(
const exception &error) {
74 FATAL(error.what() << endl);
80 cout << endl << title << endl;
82 JTimer timer1(
"Allocate");
83 JTimer timer2(
"Free");
91 for (
int event_count = 0; event_count != numberOfEvents; ++event_count) {
93 buffer.resize(numberOfAllocs);
99 for (
int i = numberOfAllocs;
i != 0; --
i, ++out) {
100 *out =
new JType_t();
110 std::shuffle(buffer.begin(), buffer.end(), g);
114 std::reverse(buffer.begin(), buffer.end());
126 const double factor = 1.0 / (numberOfEvents * numberOfAllocs);
128 timer1.print(cout, factor,
nano_t);
129 timer2.print(cout, factor,
nano_t);
141 int main(
int argc,
char **argv)
143 if (do_main<__A__>(argc, argv,
"C++") != 0)
return 1;
144 if (do_main<__B__>(argc, argv,
"JAllocator") != 0)
return 1;
145 if (do_main<__C__>(argc, argv,
"JRAM") != 0)
return 1;
Utility class to parse command line options.
int main(int argc, char *argv[])
Auxiliary base class to speed up new/delete operations of any class.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Auxiliary class to speed up new/delete operations of any class.
General purpose messaging.
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Utility class to parse command line options.
Auxiliary class to speed up new/delete operations of any class.
Base class for customized new/delete operators.