How to check memory usage of application in sgx enclave

668 views Asked by At

So I have a python script running in sgx enclave using graphene. I need to check values like memory utilization and cpu utilization. How can I check these values of the script running inside enclave?

2

There are 2 answers

0
kaichi On BEST ANSWER

For measuring memory utilization of SGX enclaves you can use the Enclave Memory Measurement Tool (sgx_emmt). This will report to you the peak usages of: stack, heap, and reserved memory. It has a big limitation that it only reports the statistics after you destroy the enclave.

On Linux, sgx_emmt is provided by sgx-gdb. Search for a chapter "Enclave Memory Measurement Tool" in the Developer Reference for more details.

You can also check this blog post to see how to conveniently use the tool.

For CPU utilization you can take a look at Intel VTune. It has an option sgx-hotspots, which allows to collect statistics from the enclave programs.

0
i3Cheese On

You can use global variable extern size_t g_peak_heap_used; inside enclave part.