keisku/gmon

gmon running in docker

deepakpjose opened this issue · 1 comments

Hi Keisku,

I'm trying out your epbf infra to see the creation & destruction of go coroutine. But I'm unclear the steps to do for it in docker environment. Can you please correct me where I'm wrong?

Steps:

  1. I've built binary using the steps from Docker installation.
  2. Ran and logged into 'gmon-e2e-x86_64' docker image.
  3. Built my go program.
  4. Ran gmon for my program. But I'm getting following error.
    root@6daa0584c713:/src# ./bin/gmon -path spinner
    2024/05/03 02:13:29 failed to set memlock rlimit: operation not permitted
    

Following is my program that creates a coroutine to spin till fibonacci calculation completes.

package main

import (
	"fmt"
	"time"
)

func main() {
	go spinner(100*time.Millisecond)
	const n = 45
	fibN := fib(n)
	fmt.Printf("\rFibonacci(%d) = %d\n", n, fibN)
} 

func spinner(delay time.Duration) {
	for {
		for _, r := range `-\|/` {
			fmt.Printf("\r%c", r)
			time.Sleep(delay)
		}
	}
}

func fib(x int) int {
	if x < 2 {
		return x
	}

	return fib(x-1) + fib(x-2)
}

Thanks,
Deepak

Hi @deepakpjose,

Can you add --privileged for docker command?

E.g.,

gmon/gmon.sh

Line 84 in 41a39e1

docker run --rm --privileged --platform linux/$arch -i -v /sys/kernel/debug:/sys/kernel/debug:ro -v ./bin/gmon:/usr/bin/gmon $image_e2e