This commit is contained in:
yanfeizhang
2024-04-24 09:01:53 +08:00
parent 4755ff2cb2
commit 12237a8e9a
3 changed files with 23 additions and 1 deletions

View File

@@ -2,4 +2,5 @@
- [物理机 cpu 系统利用率的计算过程](tests/cpu/test06)
- [容器 cpu 系统利用率的计算过程](tests/cpu/test07)
- [直接使用perf_event_open获取硬件计数](tests/cpu/test08)
- [火焰图专用测试代码](tests/cpu/test09)
- [火焰图专用测试代码](tests/cpu/test09)
- [C语言调用Golang函数原理](tests/cpu/test10)

9
tests/cpu/test10/main.c Normal file
View File

@@ -0,0 +1,9 @@
#include <stdio.h>
#include "libadd.h"
int main(void)
{
int ret = add(2,3);
printf("C调用Go函数2+3=%d", ret);
return 0;
}

12
tests/cpu/test10/main.go Normal file
View File

@@ -0,0 +1,12 @@
package main
//int add(int a, int b);
import "C"
//export add
func add(a, b C.int) C.int {
return a + b
}
func main() {
}