403Webshell
Server IP : 172.67.216.182  /  Your IP : 162.158.106.122
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/server/mysql/src/storage/perfschema/unittest/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/src/storage/perfschema/unittest/pfs_timer-t.cc
/* Copyright (c) 2008, 2023, Oracle and/or its affiliates.

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License, version 2.0,
  as published by the Free Software Foundation.

  This program is also distributed with certain software (including
  but not limited to OpenSSL) that is licensed under separate terms,
  as designated in a particular file or component or in included license
  documentation.  The authors of MySQL hereby grant you an additional
  permission to link the program and your derivative works with the
  separately licensed software that they have included with MySQL.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License, version 2.0, for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software Foundation,
  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */

#include <my_global.h>
#include <my_thread.h>
#include <pfs_timer.h>
#include "my_sys.h"
#include <tap.h>

void test_timers()
{
  ulonglong t1_a;
  ulonglong t2_a;
  ulonglong t3_a;
  ulonglong t4_a;
  ulonglong t5_a;
  ulonglong t1_b;
  ulonglong t2_b;
  ulonglong t3_b;
  ulonglong t4_b;
  ulonglong t5_b;

  init_timers();

  t1_a= get_timer_pico_value(TIMER_NAME_CYCLE);
  /* Wait 5 seconds */
  my_sleep(5000000);
  t1_b= get_timer_pico_value(TIMER_NAME_CYCLE);

  t2_a= get_timer_pico_value(TIMER_NAME_NANOSEC);
  my_sleep(5000000);
  t2_b= get_timer_pico_value(TIMER_NAME_NANOSEC);

  t3_a= get_timer_pico_value(TIMER_NAME_MICROSEC);
  my_sleep(5000000);
  t3_b= get_timer_pico_value(TIMER_NAME_MICROSEC);

  t4_a= get_timer_pico_value(TIMER_NAME_MILLISEC);
  my_sleep(5000000);
  t4_b= get_timer_pico_value(TIMER_NAME_MILLISEC);

  t5_a= get_timer_pico_value(TIMER_NAME_TICK);
  my_sleep(5000000);
  t5_b= get_timer_pico_value(TIMER_NAME_TICK);

  /*
    Print the timer values, for manual inspection by a human.
    Tests involving low level timers can not be automated.
  */
  diag("cycle a: %13llu", t1_a);
  diag("nano a: %13llu", t2_a);
  diag("micro a: %13llu", t3_a);
  diag("milli a: %13llu", t4_a);
  diag("tick a: %13llu", t5_a);

  diag("cycle b: %13llu", t1_b);
  diag("nano b: %13llu", t2_b);
  diag("micro b: %13llu", t3_b);
  diag("milli b: %13llu", t4_b);
  diag("tick b: %13llu", t5_b);

  diag("cycle b-a: %13llu", t1_b-t1_a);
  diag("nano b-a: %13llu", t2_b-t2_a);
  diag("micro b-a: %13llu", t3_b-t3_a);
  diag("milli b-a: %13llu", t4_b-t4_a);
  diag("tick b-a: %13llu", t5_b-t5_a);

  if ((t1_a == 0) && (t1_b == 0))
    skip(1, "cycle timer not implemented");
  else
    ok(t1_b > t1_a, "cycle timer ascending");

  if ((t2_a == 0) && (t2_b == 0))
    skip(1, "nano timer not implemented");
  else
    ok(t2_b > t2_a, "nano timer ascending");

  if ((t3_a == 0) && (t3_b == 0))
    skip(1, "micro timer not implemented");
  else
    ok(t3_b > t3_a, "micro timer ascending");

  if ((t4_a == 0) && (t4_b == 0))
    skip(1, "milli timer not implemented");
  else
    ok(t4_b > t4_a, "milli timer ascending");

  if ((t5_a == 0) && (t5_b == 0))
    skip(1, "tick timer not implemented");
  else
    ok(t5_b > t5_a, "tick timer ascending");
}

void do_all_tests()
{
  PFS_atomic::init();

  test_timers();

  PFS_atomic::cleanup();
}

int main(int, char **)
{
  plan(5);
  MY_INIT("pfs_timer-t");
  do_all_tests();
  return (exit_status());
}


Youez - 2016 - github.com/yon3zu
LinuXploit