How to evaluate the time spent on building(initialize) R&C network?

2 posts in this topic

I want to monitor the time spent on AMS building the R&C network, I put the command before and after the initialize() function in systemC sc_simcontext.cpp file:

   struct timeval t0;
   struct timeval t1;
   float elapsed;
   gettimeofday(&t0, 0);

   initialize( true );

   gettimeofday(&t1, 0);

   elapsed = (t1.tv_sec - t0.tv_sec) * 1000.0f + (t1.tv_usec - t0.tv_usec) / 1000.0f;

    std::cout << "SystemC Initialize Time: "<< elapsed << "ms" << std::endl;


But I think this time is not the time spent on initializing the R&C network... I checked the sca_simcontext.cpp file,  I found the class systemc_ams_initializer : sc_core::sc_module, but I didn't find which functions for invoking start to building the R&C network... Or should I monitor the function void sca_synchronization_alg::initialize() in sca_synchronization_alg.cpp file?

Where I can put the gettimeofday command to evaluate the time spent on building(initializing) R&C network? My target is to evaluate the proportion of initialized time on the total simulation time.


Thank you for sharing your idea.

Share this post

Link to post
Share on other sites

The easiest standard-conformant option I see to get an approximate idea how much time is spent in elaborating your SystemC model, which contains your RC network is by getting a time stamp using gettimeofday() just before calling sc_start() and then another from within the processing() member function of a TDF model attached to your RC network (e.g. via an sca_eln::sca_tdf::sca_vsource().

Note that I would personally prefer to use the std::chrono library introduced with C++'11 and more specifically std::chrono::high_resolution_clock::now() instead of gettimeofday() to time execution of code segments.

If you want to more precisely time the RC network setup, you would need to dive into the implementation details of the SystemC AMS extensions PoC simulator. A starting point would be to look into sca_eln::sca_implementation::sca_eln_view::setup_equations(), where the solvers for the different clusters of ELN modules are instantiated.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now