Sign inSign up

plachta11b/perf

By plachta11b

•Updated over 6 years ago

perf static binary in bash container for singularity compatibility ~ 10MB size

Image
0

91

plachta11b/perf repository overview

perf version .gb9bbe6ed63b2 (linux 5.7.rc6.r0.gb9bbe6ed63b2) tested on kernel 3.10.0-957.12.1.el7.x86_64.

perf examples: http://www.brendangregg.com/perf.html⁠

seems to be useful: https://medium.com/@geekidea_81313/running-perf-in-docker-kubernetes-7eb878afcd42⁠

⁠How to copy perf to your image:

FROM plachta11b/perf:0.1 AS builder
FROM hello-world AS hello

# whatever image you want
FROM scratch

# copy static executable from plachta11b/perf into your image
COPY --from=builder /perf /perf
COPY --from=hello /hello /hello

# run the perf binary
ENTRYPOINT ["/perf", "stat", "/hello"]

⁠build, run or extract

build: docker build --tag perf_hello .

run: docker run --cap-add SYS_ADMIN perf_hello

Hello from Docker!
This message shows that your installation appears to be working correctly.

... bla bla bla
 
 Performance counter stats for '/hello':

              0.05 msec task-clock                #    0.115 CPUs utilized          
                 0      context-switches          #    0.000 K/sec                  
                 0      cpu-migrations            #    0.000 K/sec                  
                 2      page-faults               #    0.041 M/sec                  
   <not supported>      cycles                                                      
   <not supported>      instructions                                                
   <not supported>      branches                                                    
   <not supported>      branch-misses                                               

       0.000423107 seconds time elapsed

       0.000000000 seconds user
       0.000000000 seconds sys

More privilege tuning would be needed for measuring cycles. I have used extracted binary for my project.

extract binary: docker cp $(docker create plachta11b/perf:0.1):/perf perf

After 14.8.2020 there should be dockerfile to see how it was built. I will probably forget so let me know: [email protected]⁠

Tag summary

Content type

Image

Digest

Size

10.7 MB

Last updated

over 6 years ago

docker pull plachta11b/perf:0.1