Manage objfiles with shared_ptr
[deliverable/binutils-gdb.git] / sim / common / sim-profile.h
index 8f8d95f43a182f1f39e3e7a69df3c94b82ab67ed..e70f272797b795e9cd4c5cb329b23d4f69be7b14 100644 (file)
@@ -1,22 +1,21 @@
 /* Profile header for simulators using common framework.
-   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1996-2019 Free Software Foundation, Inc.
    Contributed by Cygnus Support.
 
 This file is part of GDB, the GNU debugger.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
 
 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 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, Inc.,
-59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef SIM_PROFILE_H
 #define SIM_PROFILE_H
@@ -65,6 +64,10 @@ enum {
  | (1 << PROFILE_MODEL_IDX) \
  | (1 << PROFILE_CORE_IDX))
 
+/* Utility to set profile options.  */
+SIM_RC set_profile_option_mask (SIM_DESC sd_, const char *name_, int mask_,
+                               const char *arg_);
+
 /* Utility to parse a --profile-<foo> option.  */
 /* ??? On the one hand all calls could be confined to sim-profile.c, but
    on the other hand keeping a module's profiling option with the module's
@@ -92,19 +95,13 @@ SIM_RC sim_profile_set_option (SIM_DESC sd_, const char *name_, int idx_,
 #define WITH_PROFILE_CORE_P (WITH_PROFILE & PROFILE_core)
 
 /* If MAX_TARGET_MODES isn't defined, we can't do memory profiling.
-   ??? It is intended that this is a temporary occurence.  Normally
+   ??? It is intended that this is a temporary occurrence.  Normally
    MAX_TARGET_MODES is defined.  */
 #ifndef MAX_TARGET_MODES
 #undef WITH_PROFILE_MEMORY_P
 #define WITH_PROFILE_MEMORY_P 0
 #endif
 
-/* Only build MODEL code when the target simulator has support for it */
-#ifndef SIM_HAVE_MODEL
-#undef WITH_PROFILE_MODEL_P
-#define WITH_PROFILE_MODEL_P 0
-#endif
-
 /* Profiling install handler.  */
 MODULE_INSTALL_FN profile_install;
 
@@ -146,6 +143,10 @@ typedef struct {
   unsigned long total_insn_count;
 #define PROFILE_TOTAL_INSN_COUNT(p) ((p)->total_insn_count)
 
+  /* CPU frequency.  Always accepted, regardless of profiling options.  */
+  unsigned long cpu_freq;
+#define PROFILE_CPU_FREQ(p) ((p)->cpu_freq)
+
 #if WITH_PROFILE_INSN_P
   unsigned int *insn_count;
 #define PROFILE_INSN_COUNT(p) ((p)->insn_count)
@@ -282,8 +283,24 @@ do { \
 #define PROFILE_COUNT_CORE(cpu, addr, size, map)
 #endif /* ! core */
 
+#if WITH_PROFILE_MODEL_P
+#define PROFILE_BRANCH_TAKEN(cpu) \
+do { \
+  if (PROFILE_MODEL_P (cpu)) \
+    ++ PROFILE_MODEL_TAKEN_COUNT (CPU_PROFILE_DATA (cpu)); \
+} while (0)
+#define PROFILE_BRANCH_UNTAKEN(cpu) \
+do { \
+  if (PROFILE_MODEL_P (cpu)) \
+    ++ PROFILE_MODEL_UNTAKEN_COUNT (CPU_PROFILE_DATA (cpu)); \
+} while (0)
+#else
+#define PROFILE_BRANCH_TAKEN(cpu)
+#define PROFILE_BRANCH_UNTAKEN(cpu)
+#endif /* ! model */
+
 /* Misc. utilities.  */
 
-extern void sim_profile_print_bar (SIM_DESC, unsigned int, unsigned int, unsigned int);
+extern void sim_profile_print_bar (SIM_DESC, sim_cpu *, unsigned int, unsigned int, unsigned int);
 
 #endif /* SIM_PROFILE_H */
This page took 0.036024 seconds and 4 git commands to generate.