Wolfgang Thallergcc16 merge934c3885 months agoHistory
1687 lines · 30.2 KB · C++
RawDownload
/* Copyright (C) 2021-2026 Free Software Foundation, Inc.   Contributed by Oracle.    This file is part of GNU Binutils.    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 3, 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, 51 Franklin Street - Fifth Floor, Boston,   MA 02110-1301, USA.  */ #include "config.h"#include <stdio.h> #include "IndexMap2D.h"#include "DbeSession.h"#include "FilterExp.h"#include "Table.h"#include "util.h"#include "i18n.h" char *get_prof_data_type_name (int t){  switch (t)    {    case DATA_SAMPLE:   return NTXT("PROFDATA_TYPE_SAMPLE");    case DATA_GCEVENT:  return NTXT("PROFDATA_TYPE_GCEVENT");    case DATA_HEAPSZ:   return NTXT("PROFDATA_TYPE_HEAPSZ");    case DATA_CLOCK:    return NTXT("PROFDATA_TYPE_CLOCK");    case DATA_HWC:      return NTXT("PROFDATA_TYPE_HWC");    case DATA_SYNCH:    return NTXT("PROFDATA_TYPE_SYNCH");    case DATA_HEAP:     return NTXT("PROFDATA_TYPE_HEAP");    case DATA_OMP:      return NTXT("PROFDATA_TYPE_OMP");    case DATA_OMP2:     return NTXT("PROFDATA_TYPE_OMP2");    case DATA_OMP3:     return NTXT("PROFDATA_TYPE_OMP3");    case DATA_OMP4:     return NTXT("PROFDATA_TYPE_OMP4");    case DATA_OMP5:     return NTXT("PROFDATA_TYPE_OMP5");    case DATA_IOTRACE:  return NTXT("PROFDATA_TYPE_IOTRACE");    default: abort ();      return NTXT ("PROFDATA_TYPE_ERROR");    }} char *get_prof_data_type_uname (int t){  switch (t)    {    case DATA_SAMPLE:   return GTXT("Process-wide Resource Utilization");    case DATA_GCEVENT:  return GTXT("Java Garbage Collection Events");    case DATA_HEAPSZ:   return GTXT("Heap Size");    case DATA_CLOCK:    return GTXT("Clock Profiling");    case DATA_HWC:      return GTXT("HW Counter Profiling");    case DATA_SYNCH:    return GTXT("Synchronization Tracing");    case DATA_HEAP:     return GTXT("Heap Tracing");    case DATA_OMP:      return GTXT("OpenMP Profiling");    case DATA_OMP2:     return GTXT("OpenMP Profiling");    case DATA_OMP3:     return GTXT("OpenMP Profiling");    case DATA_OMP4:     return GTXT("OpenMP Profiling");    case DATA_OMP5:     return GTXT("OpenMP Profiling");    case DATA_IOTRACE:  return GTXT("IO Tracing");    default: abort ();      return NTXT ("PROFDATA_TYPE_ERROR");    }} int assert_level = 0; // set to 1 to bypass problematic asserts #define ASSERT_SKIP (assert_level) /* *    class PropDescr */ PropDescr::PropDescr (int _propID, const char *_name){  propID = _propID;  name = xstrdup (_name ? _name : NTXT (""));  uname = NULL;  vtype = TYPE_NONE;  flags = 0;  stateNames = NULL;  stateUNames = NULL;} PropDescr::~PropDescr (){  free (name);  free (uname);  if (stateNames)    {      stateNames->destroy ();      delete stateNames;    }  if (stateUNames)    {      stateUNames->destroy ();      delete stateUNames;    }} voidPropDescr::addState (int value, const char *stname, const char *stuname){  if (value < 0 || stname == NULL)    return;  if (stateNames == NULL)    stateNames = new Vector<char*>;  stateNames->store (value, xstrdup (stname));  if (stateUNames == NULL)    stateUNames = new Vector<char*>;  stateUNames->store (value, xstrdup (stuname));} char *PropDescr::getStateName (int value){  if (stateNames && value >= 0 && value < stateNames->size ())    return stateNames->fetch (value);  return NULL;} char *PropDescr::getStateUName (int value){  if (stateUNames && value >= 0 && value < stateUNames->size ())    return stateUNames->fetch (value);  return NULL;} /* *    class FieldDescr */ FieldDescr::FieldDescr (int _propID, const char *_name){  propID = _propID;  name = _name ? xstrdup (_name) : NULL;  offset = 0;  vtype = TYPE_NONE;  format = NULL;} FieldDescr::~FieldDescr (){  free (name);  free (format);} /* *    class PacketDescriptor */ PacketDescriptor::PacketDescriptor (DataDescriptor *_ddscr){  ddscr = _ddscr;  fields = new Vector<FieldDescr*>;} PacketDescriptor::~PacketDescriptor (){  fields->destroy ();  delete fields;} voidPacketDescriptor::addField (FieldDescr *fldDscr){  if (fldDscr == NULL)    return;  fields->append (fldDscr);} /* *    class Data */ /* Check compatibility between Datum and Data */static voidcheckCompatibility (VType_type v1, VType_type v2){  switch (v1)    {    case TYPE_NONE:    case TYPE_STRING:    case TYPE_DOUBLE:    case TYPE_OBJ:    case TYPE_DATE:      assert (v1 == v2);      break;    case TYPE_INT32:    case TYPE_UINT32:      assert (v2 == TYPE_INT32 ||	      v2 == TYPE_UINT32);      break;    case TYPE_INT64:    case TYPE_UINT64:      assert (v2 == TYPE_INT64 ||	      v2 == TYPE_UINT64);      break;    default:      assert (0);    }} class DataINT32 : public Data{public:   DataINT32 ()  {    data = new Vector<int32_t>;  }   virtual  ~DataINT32 ()  {    delete data;  }   virtual VType_type  type ()  {    return TYPE_INT32;  }   virtual void  reset ()  {    data->reset ();  }   virtual long  getSize ()  {    return data->size ();  }   virtual int  fetchInt (long i)  {    return (int) data->fetch (i);  }   virtual unsigned long long  fetchULong (long i)  {    return (unsigned long long) data->fetch (i);  }   virtual long long  fetchLong (long i)  {    return (long long) data->fetch (i);  }   virtual char *  fetchString (long i)  {    return dbe_sprintf (NTXT ("%d"), data->fetch (i));  }   virtual double  fetchDouble (long i)  {    return (double) data->fetch (i);  }   virtual void *  fetchObject (long)  {    assert (ASSERT_SKIP);    return NULL;  }   virtual void  setDatumValue (long idx, const Datum *val)  {    data->store (idx, val->i);  }   virtual void  setValue (long idx, uint64_t val)  {    data->store (idx, (int32_t) val);  }   virtual void  setObjValue (long, void*)  {    assert (ASSERT_SKIP);    return;  }   virtual int  cmpValues (long idx1, long idx2)  {    int32_t i1 = data->fetch (idx1);    int32_t i2 = data->fetch (idx2);    return i1 < i2 ? -1 : i1 > i2 ? 1 : 0;  }   virtual int  cmpDatumValue (long idx, const Datum *val)  {    int32_t i1 = data->fetch (idx);    int32_t i2 = val->i;    return i1 < i2 ? -1 : i1 > i2 ? 1 : 0;  } private:  Vector<int32_t> *data;}; class DataUINT32 : public Data{public:   DataUINT32 ()  {    data = new Vector<uint32_t>;  }   virtual  ~DataUINT32 ()  {    delete data;  }   virtual VType_type  type ()  {    return TYPE_UINT32;  }   virtual void  reset ()  {    data->reset ();  }   virtual long  getSize ()  {    return data->size ();  }   virtual int  fetchInt (long i)  {    return (int) data->fetch (i);  }   virtual unsigned long long  fetchULong (long i)  {    return (unsigned long long) data->fetch (i);  }   virtual long long  fetchLong (long i)  {    return (long long) data->fetch (i);  }   virtual char *  fetchString (long i)  {    return dbe_sprintf (NTXT ("%u"), data->fetch (i));  }   virtual double  fetchDouble (long i)  {    return (double) data->fetch (i);  }   virtual void *  fetchObject (long)  {    assert (ASSERT_SKIP);    return NULL;  }   virtual void  setDatumValue (long idx, const Datum *val)  {    data->store (idx, val->i);  }   virtual void  setValue (long idx, uint64_t val)  {    data->store (idx, (uint32_t) val);  }   virtual void  setObjValue (long, void*)  {    assert (ASSERT_SKIP);    return;  }   virtual int  cmpValues (long idx1, long idx2)  {    uint32_t u1 = data->fetch (idx1);    uint32_t u2 = data->fetch (idx2);    return u1 < u2 ? -1 : u1 > u2 ? 1 : 0;  }   virtual int  cmpDatumValue (long idx, const Datum *val)  {    uint32_t u1 = data->fetch (idx);    uint32_t u2 = (uint32_t) val->i;    return u1 < u2 ? -1 : u1 > u2 ? 1 : 0;  } private:  Vector<uint32_t> *data;}; class DataINT64 : public Data{public:   DataINT64 ()  {    data = new Vector<int64_t>;  }   virtual  ~DataINT64 ()  {    delete data;  }   virtual VType_type  type ()  {    return TYPE_INT64;  }   virtual void  reset ()  {    data->reset ();  }   virtual long  getSize ()  {    return data->size ();  }   virtual int  fetchInt (long i)  {    return (int) data->fetch (i);  }   virtual unsigned long long  fetchULong (long i)  {    return (unsigned long long) data->fetch (i);  }   virtual long long  fetchLong (long i)  {    return (long long) data->fetch (i);  }   virtual char *  fetchString (long i)  {    return dbe_sprintf (NTXT ("%lld"), (long long) data->fetch (i));  }   virtual double  fetchDouble (long i)  {    return (double) data->fetch (i);  }   virtual void *  fetchObject (long)  {    assert (ASSERT_SKIP);

Lines 1–500 of 1687.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t