Frameworks for performance testing at the unit test level (code level)

Has anybody experience with frameworks for performance testing at the unit test level (code level)? The idea is to be able to trace request and check response times.

Not exactly a true answer to your question - I’ve not used a framework per se, but I did stumble across this blog about googletest: In my previous life as a developer I used what was built into the runtime to add {timestamp,line} to a hashmap.

Though you mention request and response - are you interested in testing latency?

Isn’t a simple timer before and after the target function of a unit check enough?

mock1 = Mock()
mock2 = Mock()
target = Target(mock1, mock2)
time_before =
result = target.doFunStuff()
assert(result == “blablabla”)
log.time( - time_before)

I’m not sure what you are trying to accomplish. In unit testing you typically have gotten rid of all integrations which leaves very little to actually performance test. But I guess if we are talking about response times you have some integrations in place that you want to test.

In one place we used Gatling to have a set of performance test that we performed when doing the building of the service. This allows you to easily maintain the performance test code together with the rest of the code. Similar to unit tests.

Hope that helps.