HEX
Server: Apache/2.4.34 (Red Hat) OpenSSL/1.0.2k-fips
System: Linux WORDPRESS 3.10.0-1160.118.1.el7.x86_64 #1 SMP Thu Apr 4 03:33:23 EDT 2024 x86_64
User: digital (1020)
PHP: 7.2.24
Disabled: NONE
Upload Files
File: //usr/share/systemtap/examples/process/semop-watch.stp
global threads;
global times;

probe syscall.{semop,semtimedop}
{
  sembuf_sz = @cast_sizeof("struct sembuf");
  res = sprintf("set %d sems", semid)

  %( systemtap_v < "2.3" %? 
     if (tsops_uaddr != 0) sops_uaddr = tsops_uaddr;
     /* ignore warning for semtimedop's 'tsops_uaddr never-assigned'. */
  %)

  for(i = 0; i < nsops; i++) {
    offset = i * sembuf_sz;
    pointer = sops_uaddr + offset;
    num_addr = & @cast(pointer, "struct sembuf")->sem_num;
    num = user_short(num_addr);

    res = sprintf("%s %d", res, num);
  }
  res = sprintf("%s\n", res);

  threads[tid()] = res;
  times[tid()] = gettimeofday_us();
}

probe syscall.{semop,semtimedop}.return
{
  printf("Thread %d took %dus to operate on %s\n", tid(),
         gettimeofday_us() - times[tid()], threads[tid()]);
}