Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Linux/tools/testing/selftests/bpf/progs/   (Open Source Betriebssystem Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 1 kB image not shown  

Quelle  test_urandom_usdt.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2022 Meta Platforms, Inc. and affiliates. */

#include "vmlinux.h"
#include <bpf/bpf_helpers.h>
#include <bpf/usdt.bpf.h>

int urand_pid;

int urand_read_without_sema_call_cnt;
int urand_read_without_sema_buf_sz_sum;

SEC("usdt/./urandom_read:urand:read_without_sema")
int BPF_USDT(urand_read_without_sema, int iter_num, int iter_cnt, int buf_sz)
{
 if (urand_pid != (bpf_get_current_pid_tgid() >> 32))
  return 0;

 __sync_fetch_and_add(&urand_read_without_sema_call_cnt, 1);
 __sync_fetch_and_add(&urand_read_without_sema_buf_sz_sum, buf_sz);

 return 0;
}

int urand_read_with_sema_call_cnt;
int urand_read_with_sema_buf_sz_sum;

SEC("usdt/./urandom_read:urand:read_with_sema")
int BPF_USDT(urand_read_with_sema, int iter_num, int iter_cnt, int buf_sz)
{
 if (urand_pid != (bpf_get_current_pid_tgid() >> 32))
  return 0;

 __sync_fetch_and_add(&urand_read_with_sema_call_cnt, 1);
 __sync_fetch_and_add(&urand_read_with_sema_buf_sz_sum, buf_sz);

 return 0;
}

int urandlib_read_without_sema_call_cnt;
int urandlib_read_without_sema_buf_sz_sum;

SEC("usdt/./liburandom_read.so:urandlib:read_without_sema")
int BPF_USDT(urandlib_read_without_sema, int iter_num, int iter_cnt, int buf_sz)
{
 if (urand_pid != (bpf_get_current_pid_tgid() >> 32))
  return 0;

 __sync_fetch_and_add(&urandlib_read_without_sema_call_cnt, 1);
 __sync_fetch_and_add(&urandlib_read_without_sema_buf_sz_sum, buf_sz);

 return 0;
}

int urandlib_read_with_sema_call_cnt;
int urandlib_read_with_sema_buf_sz_sum;

SEC("usdt/./liburandom_read.so:urandlib:read_with_sema")
int BPF_USDT(urandlib_read_with_sema, int iter_num, int iter_cnt, int buf_sz)
{
 if (urand_pid != (bpf_get_current_pid_tgid() >> 32))
  return 0;

 __sync_fetch_and_add(&urandlib_read_with_sema_call_cnt, 1);
 __sync_fetch_and_add(&urandlib_read_with_sema_buf_sz_sum, buf_sz);

 return 0;
}

char _license[] SEC("license") = "GPL";

Messung V0.5
C=97 H=94 G=95

¤ Dauer der Verarbeitung: 0.13 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.