---
name: "__gnu_profile"
section: "3cxx"
platform: "linux"
package: "libstdc++-9-doc"
version: "9.3.0-22"
release: "Debian 11 (Bullseye)"
platforms: ["linux"]
url: "https://new.carta.tech/__gnu_profile"
---

# \_\_gnu\_profile(3cxx)

GNU profile code for public use.

## NAME

\_\_gnu\_profile - GNU profile code for public use.

## SYNOPSIS

### Classes

class **\_\_container\_size\_info**\
 A container size instrumentation line in the object table.  class **\_\_container\_size\_stack\_info**\
 A container size instrumentation line in the stack table.  class **\_\_hashfunc\_info**\
 A hash performance instrumentation line in the object table.  class **\_\_hashfunc\_stack\_info**\
 A hash performance instrumentation line in the stack table.  class **\_\_list2vector\_info**\
 A list-to-vector instrumentation line in the object table.  class **\_\_map2umap\_info**\
 A map-to-unordered\_map instrumentation line in the object table.  class **\_\_map2umap\_stack\_info**\
 A map-to-unordered\_map instrumentation line in the stack table.  class **\_\_object\_info\_base**\
 Base class for a line in the object table.  struct **\_\_reentrance\_guard**\
 Reentrance guard.  class **\_\_stack\_hash**\
 Hash function for summary trace using call stack as index.  class **\_\_trace\_base**\
 Base class for all trace producers.  class **\_\_trace\_container\_size**\
 Container size instrumentation trace producer.  class **\_\_trace\_hash\_func**\
 Hash performance instrumentation producer.  class **\_\_trace\_hashtable\_size**\
 Hashtable size instrumentation trace producer.  class **\_\_trace\_map2umap**\
 Map-to-unordered\_map instrumentation producer.  class **\_\_trace\_vector\_size**\
 Hashtable size instrumentation trace producer.  class **\_\_trace\_vector\_to\_list**\
 Vector-to-list instrumentation producer.  class **\_\_vector2list\_info**\
 A vector-to-list instrumentation line in the object table.  class **\_\_vector2list\_stack\_info**\
 A vector-to-list instrumentation line in the stack table.  struct **\_\_warning\_data**\
 Representation of a warning.

### Typedefs

typedef std::::vector\< \_\_cost\_factor \* \> **\_\_cost\_factor\_vector**\
 typedef std::::unordered\_map\< **std::string**, **std::string** \> **\_\_env\_t**\
 Internal environment. Values can be set one of two ways: 1. In config file 'var = value'. The default config file path is libstdcxx-profile.conf. 2. By setting process environment variables. For instance, in a Bash shell you can set the unit cost of iterating through a map like this: export \_\_map\_iterate\_cost\_factor=5.0. If a value is set both in the input file and through an environment variable, the environment value takes precedence.  typedef void \* **\_\_instruction\_address\_t**\
 typedef std::::vector\< \_\_instruction\_address\_t \> **\_\_stack\_npt**\
 typedef \_\_stack\_npt \* **\_\_stack\_t**\
 typedef std::::vector\< **\_\_warning\_data** \> **\_\_warning\_vector\_t**\

### Enumerations

enum **\_\_state\_type** { **\_\_ON**, **\_\_OFF**, **\_\_INVALID** }\

### Functions

std::size\_t **\_\_env\_to\_size\_t** (const char \*\_\_env\_var, std::size\_t \_\_default\_value)\
 template\<typename \_InputIterator , typename \_Function \> \_Function **\_\_for\_each** (\_InputIterator \_\_first, \_InputIterator \_\_last, \_Function \_\_f)\
 \_\_cost\_factor\_vector \*& **\_\_get\_\_\_cost\_factors** ()\
 **\_\_env\_t** & **\_\_get\_\_\_env** ()\
 \_\_gnu\_cxx::\_\_mutex & **\_\_get\_\_\_global\_mutex** ()\
 Master lock.  \_\_cost\_factor & **\_\_get\_\_\_list\_iterate\_cost\_factor** ()\
 \_\_cost\_factor & **\_\_get\_\_\_list\_resize\_cost\_factor** ()\
 \_\_cost\_factor & **\_\_get\_\_\_list\_shift\_cost\_factor** ()\
 \_\_cost\_factor & **\_\_get\_\_\_map\_erase\_cost\_factor** ()\
 \_\_cost\_factor & **\_\_get\_\_\_map\_find\_cost\_factor** ()\
 \_\_cost\_factor & **\_\_get\_\_\_map\_insert\_cost\_factor** ()\
 \_\_cost\_factor & **\_\_get\_\_\_map\_iterate\_cost\_factor** ()\
 \_\_cost\_factor & **\_\_get\_\_\_umap\_erase\_cost\_factor** ()\
 \_\_cost\_factor & **\_\_get\_\_\_umap\_find\_cost\_factor** ()\
 \_\_cost\_factor & **\_\_get\_\_\_umap\_insert\_cost\_factor** ()\
 \_\_cost\_factor & **\_\_get\_\_\_umap\_iterate\_cost\_factor** ()\
 \_\_cost\_factor & **\_\_get\_\_\_vector\_iterate\_cost\_factor** ()\
 \_\_cost\_factor & **\_\_get\_\_\_vector\_resize\_cost\_factor** ()\
 \_\_cost\_factor & **\_\_get\_\_\_vector\_shift\_cost\_factor** ()\
 **\_\_trace\_hash\_func** \*& **\_\_get\_\_S\_hash\_func** ()\
 **\_\_trace\_hashtable\_size** \*& **\_\_get\_\_S\_hashtable\_size** ()\
 \_\_trace\_list\_to\_slist \*& **\_\_get\_\_S\_list\_to\_slist** ()\
 \_\_trace\_list\_to\_vector \*& **\_\_get\_\_S\_list\_to\_vector** ()\
 **\_\_trace\_map2umap** \*& **\_\_get\_\_S\_map2umap** ()\
 std::size\_t & **\_\_get\_\_S\_max\_mem** ()\
 std::size\_t & **\_\_get\_\_S\_max\_stack\_depth** ()\
 std::size\_t & **\_\_get\_\_S\_max\_warn\_count** ()\
 const char \*& **\_\_get\_\_S\_trace\_file\_name** ()\
 **\_\_trace\_vector\_size** \*& **\_\_get\_\_S\_vector\_size** ()\
 **\_\_trace\_vector\_to\_list** \*& **\_\_get\_\_S\_vector\_to\_list** ()\
 \_\_stack\_t **\_\_get\_stack** ()\
 template\<typename \_Container \> void **\_\_insert\_top\_n** (\_Container &\_\_output, const typename \_Container::value\_type &\_\_value, typename \_Container::size\_type \_\_n)\
 bool **\_\_is\_invalid** ()\
 bool **\_\_is\_off** ()\
 bool **\_\_is\_on** ()\
 int **\_\_log2** (std::size\_t \_\_size)\
 int **\_\_log\_magnitude** (float \_\_f)\
 float **\_\_map\_erase\_cost** (std::size\_t \_\_size)\
 float **\_\_map\_find\_cost** (std::size\_t \_\_size)\
 float **\_\_map\_insert\_cost** (std::size\_t \_\_size)\
 std::size\_t **\_\_max\_mem** ()\
 FILE \* **\_\_open\_output\_file** (const char \*\_\_extension)\
 bool **\_\_profcxx\_init** ()\
 This function must be called by each instrumentation point.  void **\_\_profcxx\_init\_unconditional** ()\
 void **\_\_read\_cost\_factors** ()\
 template\<typename \_ForwardIterator , typename \_Tp \> \_ForwardIterator **\_\_remove** (\_ForwardIterator \_\_first, \_ForwardIterator \_\_last, const \_Tp &\_\_value)\
 void **\_\_report** ()\
 Final report method, registered with **atexit**.  void **\_\_report\_and\_free** ()\
 void **\_\_set\_cost\_factors** ()\
 void **\_\_set\_max\_mem** ()\
 void **\_\_set\_max\_stack\_trace\_depth** ()\
 void **\_\_set\_max\_warn\_count** ()\
 void **\_\_set\_trace\_path** ()\
 std::size\_t **\_\_size** (\_\_stack\_t \_\_stack)\
 std::size\_t **\_\_stack\_max\_depth** ()\
 template\<typename \_Container \> void **\_\_top\_n** (const \_Container &\_\_input, \_Container &\_\_output, typename \_Container::size\_type \_\_n)\
 **\_\_hashfunc\_info** \* **\_\_trace\_hash\_func\_construct** ()\
 void **\_\_trace\_hash\_func\_destruct** (**\_\_hashfunc\_info** \*, std::size\_t, std::size\_t, std::size\_t)\
 void **\_\_trace\_hash\_func\_free** ()\
 void **\_\_trace\_hash\_func\_init** ()\
 void **\_\_trace\_hash\_func\_report** (FILE \*\_\_f, \_\_warning\_vector\_t &\_\_warnings)\
 **\_\_container\_size\_info** \* **\_\_trace\_hashtable\_size\_construct** (std::size\_t)\
 void **\_\_trace\_hashtable\_size\_destruct** (**\_\_container\_size\_info** \*, std::size\_t, std::size\_t)\
 void **\_\_trace\_hashtable\_size\_free** ()\
 void **\_\_trace\_hashtable\_size\_init** ()\
 void **\_\_trace\_hashtable\_size\_report** (FILE \*\_\_f, \_\_warning\_vector\_t &\_\_warnings)\
 void **\_\_trace\_hashtable\_size\_resize** (**\_\_container\_size\_info** \*, std::size\_t, std::size\_t)\
 \_\_list2slist\_info \* **\_\_trace\_list\_to\_slist\_construct** ()\
 void **\_\_trace\_list\_to\_slist\_destruct** (\_\_list2slist\_info \*)\
 void **\_\_trace\_list\_to\_slist\_free** ()\
 void **\_\_trace\_list\_to\_slist\_init** ()\
 void **\_\_trace\_list\_to\_slist\_operation** (\_\_list2slist\_info \*)\
 void **\_\_trace\_list\_to\_slist\_report** (FILE \*\_\_f, \_\_warning\_vector\_t &\_\_warnings)\
 void **\_\_trace\_list\_to\_slist\_rewind** (\_\_list2slist\_info \*)\
 **\_\_list2vector\_info** \* **\_\_trace\_list\_to\_vector\_construct** ()\
 void **\_\_trace\_list\_to\_vector\_destruct** (**\_\_list2vector\_info** \*)\
 void **\_\_trace\_list\_to\_vector\_free** ()\
 void **\_\_trace\_list\_to\_vector\_init** ()\
 void **\_\_trace\_list\_to\_vector\_insert** (**\_\_list2vector\_info** \*, std::size\_t, std::size\_t)\
 void **\_\_trace\_list\_to\_vector\_invalid\_operator** (**\_\_list2vector\_info** \*)\
 void **\_\_trace\_list\_to\_vector\_iterate** (**\_\_list2vector\_info** \*, int)\
 void **\_\_trace\_list\_to\_vector\_report** (FILE \*\_\_f, \_\_warning\_vector\_t &\_\_warnings)\
 void **\_\_trace\_list\_to\_vector\_resize** (**\_\_list2vector\_info** \*, std::size\_t, std::size\_t)\
 **\_\_map2umap\_info** \* **\_\_trace\_map\_to\_unordered\_map\_construct** ()\
 void **\_\_trace\_map\_to\_unordered\_map\_destruct** (**\_\_map2umap\_info** \*)\
 void **\_\_trace\_map\_to\_unordered\_map\_erase** (**\_\_map2umap\_info** \*, std::size\_t, std::size\_t)\
 void **\_\_trace\_map\_to\_unordered\_map\_find** (**\_\_map2umap\_info** \*, std::size\_t)\
 void **\_\_trace\_map\_to\_unordered\_map\_free** ()\
 void **\_\_trace\_map\_to\_unordered\_map\_init** ()\
 void **\_\_trace\_map\_to\_unordered\_map\_insert** (**\_\_map2umap\_info** \*, std::size\_t, std::size\_t)\
 void **\_\_trace\_map\_to\_unordered\_map\_invalidate** (**\_\_map2umap\_info** \*)\
 void **\_\_trace\_map\_to\_unordered\_map\_iterate** (**\_\_map2umap\_info** \*, std::size\_t)\
 void **\_\_trace\_map\_to\_unordered\_map\_iterate** (**\_\_map2umap\_info** \*\_\_info, int)\
 void **\_\_trace\_map\_to\_unordered\_map\_report** (FILE \*\_\_f, \_\_warning\_vector\_t &\_\_warnings)\
 template\<typename \_\_object\_info , typename \_\_stack\_info \> void **\_\_trace\_report** (**\_\_trace\_base**\< \_\_object\_info, \_\_stack\_info \> \*\_\_cont, FILE \*\_\_f, \_\_warning\_vector\_t &\_\_warnings)\
 **\_\_container\_size\_info** \* **\_\_trace\_vector\_size\_construct** (std::size\_t)\
 void **\_\_trace\_vector\_size\_destruct** (**\_\_container\_size\_info** \*, std::size\_t, std::size\_t)\
 void **\_\_trace\_vector\_size\_free** ()\
 void **\_\_trace\_vector\_size\_init** ()\
 void **\_\_trace\_vector\_size\_report** (FILE \*, \_\_warning\_vector\_t &)\
 void **\_\_trace\_vector\_size\_resize** (**\_\_container\_size\_info** \*, std::size\_t, std::size\_t)\
 **\_\_vector2list\_info** \* **\_\_trace\_vector\_to\_list\_construct** ()\
 void **\_\_trace\_vector\_to\_list\_destruct** (**\_\_vector2list\_info** \*)\
 void **\_\_trace\_vector\_to\_list\_free** ()\
 void **\_\_trace\_vector\_to\_list\_init** ()\
 void **\_\_trace\_vector\_to\_list\_insert** (**\_\_vector2list\_info** \*, std::size\_t, std::size\_t)\
 void **\_\_trace\_vector\_to\_list\_invalid\_operator** (**\_\_vector2list\_info** \*)\
 void **\_\_trace\_vector\_to\_list\_iterate** (**\_\_vector2list\_info** \*, int)\
 void **\_\_trace\_vector\_to\_list\_report** (FILE \*, \_\_warning\_vector\_t &)\
 void **\_\_trace\_vector\_to\_list\_resize** (**\_\_vector2list\_info** \*, std::size\_t, std::size\_t)\
 bool **\_\_turn** (\_\_state\_type \_\_s)\
 bool **\_\_turn\_off** ()\
 bool **\_\_turn\_on** ()\
 void **\_\_write** (FILE \*\_\_f, \_\_stack\_t \_\_stack)\
 void **\_\_write\_cost\_factors** ()\
 **\_GLIBCXX\_PROFILE\_DEFINE\_DATA** (\_\_state\_type, \_\_state, \_\_INVALID)\

## Detailed Description

GNU profile code for public use.

## Typedef Documentation

### typedef std:: ::unordered\_map\<std::string, std::string\> \_\_gnu\_profile::\_\_env\_t

Internal environment. Values can be set one of two ways: 1. In config file 'var = value'. The default config file path is libstdcxx-profile.conf. 2. By setting process environment variables. For instance, in a Bash shell you can set the unit cost of iterating through a map like this: export \_\_map\_iterate\_cost\_factor=5.0. If a value is set both in the input file and through an environment variable, the environment value takes precedence.

Definition at line 65 of file profiler\_trace.h.

## Function Documentation

### \_\_gnu\_cxx::\_\_mutex& \_\_gnu\_profile::\_\_get\_\_\_global\_mutex ()` [inline]`

Master lock.

Definition at line 70 of file profiler\_trace.h.

### bool \_\_gnu\_profile::\_\_profcxx\_init ()` [inline]`

This function must be called by each instrumentation point. The common path is inlined fully.

Definition at line 653 of file profiler\_trace.h.

### void \_\_gnu\_profile::\_\_report ()` [inline]`

Final report method, registered with **atexit**. This can also be called directly by user code, including signal handlers. It is protected against deadlocks by the reentrance guard in profiler.h. However, when called from a signal handler that triggers while within \_\_gnu\_profile (under the guarded zone), no output will be produced.

Definition at line 448 of file profiler\_trace.h.

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
