0

Let's say I've a set of deterministic programs that take some data as input. I'm interested to calculate the "time" until a program terminates for different input data. I don't care about the actual time it takes but I need a metric that is

  • reproducible (if I run a specific program with specific data twice, I get at least approximately the same result) and
  • comparable (if I run e.g. two different programs with the same data and the returned metric for the first program is 100 and the one for the second program is 50, this must allow to claim that the first program takes twice as long to run with this input data).

My setup is a virtual machine that is hosted on a server that has substantially different loads at different times of the day. My limited understanding would suggest that in case the host server is strongly used, the guest virtual machine gets less compute time and runs slower, so using something like wall-time is certainly not going to work. I've full control over the virtual machine. I don't have control over the host server.

Does anyone of you know how I can achieve my goal reliably?

  • You would have to come up with a metric that allows you to account for the host load. Depending on the virtualization solution you might be able to give that VM a "guaranteed"/higher priority access to resources. One way to "kind of" account for it might be a solution similar to what Dan Kaminsky did for his "I want these bugs of my internet" talk. Essentially run a fixed timer (sub second) that uses the timestamp and compares the time between each. If it is bigger than your interval you know the machine was loaded (~slide 12/nice.js). Another option would be counting CPU cycles for that app. – Seth Aug 8 '17 at 10:07
  • Hi Seth, Thank you for your note. Do you have experience with counting CPU cycles? This sounds like a great way of proceeding with this. – So Well Aug 8 '17 at 10:36
  • No but there should be resources available like How to get the number of CPU cycles used by a process. You will probably have to adapt it to the code your examining. – Seth Aug 8 '17 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.