Home › Forum › SOFA Community Help › Programming with SOFA › Statistics on AdvancedTimer
 This topic has 7 replies, 3 voices, and was last updated 7 months, 4 weeks ago by Sarah.

AuthorPosts

11 May 2020 at 15 h 15 min #16161
Hi!
While not directly related. I thought my question about the statistics retrieved from the Advanced timers may be useful here.
My questions concerns the interpretation of the data.
My question cencerns what the various data types represent? What doesNUM
entail? Is there any reason that theTOTAL
of theTOTAL
is a factor of 100 larger then the mean, are they multiplied byNUM
, which corresponds most of the time? And are the units of theTOTAL
then in ms or those of the mean?When collecting the data you get the following, as retrieved from the Sofa documentation:
Steps Duration Statistics (in ms) : LEVEL START NUM MIN MAX MEAN DEV TOTAL PERCENT ID 0 0 100 86.57 127.50 109.99 7.77 10999.1 100 TOTAL 1 0.06 1 86.32 127.25 109.75 7.75 109.75 99.78 .Mechanical 2 0.09 1 79.42 112.21 99.97 7.02 99.97 90.89 ..Build linear equation 3 0.09 1 0.84 1.36 1.14 0.14 1.14 1.04 ...forces in the righthand term 3 1.34 1 0.07 0.14 0.10 0.02 0.10 0.09 ...shift and project independent states 3 1.44 1 0.39 0.68 0.55 0.08 0.55 0.50 ...local M 3 2.23 2 7.52 17.67 12.72 2.34 25.44 23.13 ...J products 3 27.70 1 0.28 0.54 0.41 0.06 0.41 0.37 ...local K 3 28.13 1 54.07 79.54 70.61 5.53 70.61 64.20 ...JMJt, JKJt, JCJt 3 98.75 1 0.88 2.29 1.31 0.24 1.32 1.20 ...implicit equation: scaling and sum of matrices, update righthand term 2 100.06 1 2.71 4.79 3.75 0.51 3.75 3.41 ..Solve linear equation 1 109.84 1 0.01 0.02 0.02 0 0.02 0.01 .UpdateMapping 2 109.84 1 0 0 0 0 0 0 ..UpdateMappingEndEvent 1 109.85 1 0.09 0.28 0.14 0.03 0.14 0.12 .UpdateBBox
I was trying to find more infromation on these outputs online but was having a hard time finding answers to these possibly rather trivial questions. Help would be appreciated!
Kind regards,
Sarah
13 May 2020 at 21 h 42 min #16200Hi!
Was just wondering if it would be better to open my previous post as a new topic. Would be great to get to understand the Advanced Timer more.Best, Sarah
14 May 2020 at 23 h 26 min #16242Hi @sarah
I moved your question in a new topic.
To be honest, I am not super familiar with the details of these stats.I would say that:
– 100 is the number of steps which are run and the digits in the table are actually average over these 100 iterations
– NUM means how many times this is computed
– TOTAL which is multiplied by 100 (10999.1) I would say this is an error, and should be 109.991)It would be nice if you would be curious and check into the code, and even put some fix there! I am as knowledgeable as you are here 🙂
Still I hope this helps a bit!
CheersHugo
15 May 2020 at 14 h 43 min #16271Hi Hugo,
I looked into some of the code of the AdvancedTimer.cpp. This is what I found:
json TimerData::createJSONArray(int s,json jsonObject, StepData& data) { double value = 0; ctime_t ttotal = stepData[AdvancedTimer::IdStep()].ttotal; // Level : value = strToDouble(getVal(data.level), 4); jsonObject["Level"] = value; // Start value = strToDouble(getTime(data.tstart, data.numIt), 4); jsonObject["Start"] = value; // Num value = strToDouble(getVal(data.num, (s == 0) ? 1 : nbIter), 4); jsonObject["Num"] = value; // TMin value = strToDouble(getTime(data.tmin), 4); jsonObject["Min"] = value; // TMax value = strToDouble(getTime(data.tmax), 4); jsonObject["Max"] = value; // Mean double mean = (double)data.ttotal / data.num; value = strToDouble(getTime((ctime_t)mean), 4); jsonObject["Mean"] = value; // Dev value = strToDouble(getTime((ctime_t)(sqrt((double)data.ttotal2/data.num  mean*mean))), 4); jsonObject["Dev"] = value; // Total value = strToDouble(getTime(data.ttotal, (s == 0) ? 1 : nbIter), 4); jsonObject["Total"] = value; // Percent value = strToDouble(getVal(100.0*data.ttotal / (double) ttotal), 4); jsonObject["Percent"] = value; return jsonObject; }
So the Total (ttotal) is right at least, that the mean is the one that takes the num into consideration. It would seem most clear if num represented the number of itteration but it is also remarkable that ‘nbIter’ is a value and that in the folowing part of the code also introduces ‘numIt’. So am a bit confused about if these three values (num, nbIter, numIt) are referring to the same thing? Also I don’t quite understand yet why NUM is different for the different components in the example, as unless it just did multiple itterations of one of the component they should be the same right. And this makes me wonder wheter it is actually referring to the itterations of the simulation as a whole, or to something different.
class ValData { public: int num, numIt; double vmin; double vmax; double vtotal; double vtotal2; double vtotalIt; int lastIt; ValData() : num(0), numIt(0), vmin(0), vmax(0), vtotal(0), vtotal2(0), vtotalIt(0), lastIt(1) {} };
So far I ran my simulation, printing the log at every itteration and with that all my NUM are equal to 1, whilst with that avoiding the problem I don’t think the question has completely been answered yet. The interpretation of the statistics may be a useful question or comment to add in the documentation, in particular for the example placed there, as I think this could help many. Thank you! Hope that this is of use to people in the future.
Best,
Sarah23 May 2020 at 22 h 41 min #16341Hi @sarah
It’s good to dare looking in the code.
Do never hesitate to propose also improvement to the doc yourself, the documentation is open for contribution as well.I will try to work on it, since the topic is fresh.
Hugo
25 May 2020 at 19 h 13 min #16369Hi @sarah,
the output table is indeed not very user friendly. In fact the 1st line should be read separately from the rest of the table.
The first line is showing mean values over 100 iterations of your simulation except for the “Total” which is the total in ms of the 100 iterations.Then if you look at the rest of the table, this is the detail (of the 1st line) for one simulation step. So there the NUM is the number of time the operation is done per simulation step. You see that “Mechanical” and “UpdateBBox” are the 2 mains operations of your step and if you sum their % you nearly get the 100%, here I think the visual/draw operation is not shown.
Also, I don’t know what is your usage of the advancedTimer but there is a graphical version of it:
See full PR here.
I apologize that this is not mentioned in the doc… it is on my todo list.Erik
31 May 2020 at 18 h 59 min #16465Hey
@epernod I added some text and image here about our discussion and about your profiler.
Do not hesitate to complete it.Shall I close the topic for now?
BestHugo
2 June 2020 at 11 h 18 min #16513Hi Hugo and Erik!
Thanks for all the tips, has been helpful. Also it is very cool to see the documentation and other options expand. Yes, I’ll close the topic. I think it has been resolved.Best,
Sarah

AuthorPosts
 You must be logged in to reply to this topic.