I have been working on a project which aims to automate performance testing of a few stored procedures on our servers using SSIS package. Previously it was done manually using SQL Server Profiler. We used to store the trace table and then compare the latest data (Duration, CPU, Reads) with the old data. As part of the automation, we are using extended events to store the events data to a file and then reading the data to a database table.
The problem I am facing is whenever I run the stored procedures manually the data I am getting is not consistent with data I am getting when running those stored procedures with the automation tool. I am pretty sure we have implemented the extended events correctly in the tool.
Below are the results I am getting (cache cleaned before testing manually as well as using tool)
There is 40-50% CPU variation and >100% duration variation for a few stored procedures.
Can somebody please suggest the probable causes for the same? I could find no other way except using XEvents to automate the task.
EDIT1: Snapshot of the Data