qemu/tests/plugin/empty.c
<<
>>
Prefs
   1/*
   2 * Copyright (C) 2018, Emilio G. Cota <cota@braap.org>
   3 *
   4 * License: GNU GPL, version 2 or later.
   5 *   See the COPYING file in the top-level directory.
   6 */
   7#include <inttypes.h>
   8#include <assert.h>
   9#include <stdlib.h>
  10#include <string.h>
  11#include <unistd.h>
  12#include <stdio.h>
  13
  14#include <qemu-plugin.h>
  15
  16QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION;
  17
  18/*
  19 * Empty TB translation callback.
  20 * This allows us to measure the overhead of injecting and then
  21 * removing empty instrumentation.
  22 */
  23static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
  24{ }
  25
  26QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
  27                                           const qemu_info_t *info,
  28                                           int argc, char **argv)
  29{
  30    qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans);
  31    return 0;
  32}
  33