| 1 |
.TH "hwlocality_object_strings" 3 "Version 2.14.0" "Hardware Locality (hwloc)" \" -*- nroff -*- |
| 2 |
.ad l |
| 3 |
.nh |
| 4 |
.SH NAME |
| 5 |
hwlocality_object_strings \- Converting between Object Types and Attributes, and Strings |
| 6 |
.SH SYNOPSIS |
| 7 |
.br |
| 8 |
.PP |
| 9 |
.SS "Functions" |
| 10 |
|
| 11 |
.in +1c |
| 12 |
.ti -1c |
| 13 |
.RI "const char * \fBhwloc_obj_type_string\fP (\fBhwloc_obj_type_t\fP type)" |
| 14 |
.br |
| 15 |
.ti -1c |
| 16 |
.RI "int \fBhwloc_obj_type_snprintf\fP (char *restrict string, size_t size, \fBhwloc_obj_t\fP obj, int verbose)" |
| 17 |
.br |
| 18 |
.ti -1c |
| 19 |
.RI "int \fBhwloc_obj_attr_snprintf\fP (char *restrict string, size_t size, \fBhwloc_obj_t\fP obj, const char *restrict separator, int verbose)" |
| 20 |
.br |
| 21 |
.ti -1c |
| 22 |
.RI "int \fBhwloc_type_sscanf\fP (const char *string, \fBhwloc_obj_type_t\fP *typep, union \fBhwloc_obj_attr_u\fP *attrp, size_t attrsize)" |
| 23 |
.br |
| 24 |
.ti -1c |
| 25 |
.RI "int \fBhwloc_type_sscanf_as_depth\fP (const char *string, \fBhwloc_obj_type_t\fP *typep, \fBhwloc_topology_t\fP topology, int *depthp)" |
| 26 |
.br |
| 27 |
.in -1c |
| 28 |
.SH "Detailed Description" |
| 29 |
.PP |
| 30 |
|
| 31 |
.SH "Function Documentation" |
| 32 |
.PP |
| 33 |
.SS "int hwloc_obj_attr_snprintf (char *restrict string, size_t size, \fBhwloc_obj_t\fP obj, const char *restrict separator, int verbose)" |
| 34 |
|
| 35 |
.PP |
| 36 |
Stringify the attributes of a given topology object into a human-readable form\&. Attribute values are separated by \fRseparator\fP\&. |
| 37 |
|
| 38 |
.PP |
| 39 |
Only the major attributes are printed in non-verbose mode\&. |
| 40 |
|
| 41 |
.PP |
| 42 |
If \fRsize\fP is 0, \fRstring\fP may safely be \fRNULL\fP\&. |
| 43 |
|
| 44 |
.PP |
| 45 |
\fBReturns\fP |
| 46 |
.RS 4 |
| 47 |
the number of characters that were actually written if not truncating, or that would have been written (not including the ending \fR\\0\fP)\&. |
| 48 |
.RE |
| 49 |
.PP |
| 50 |
|
| 51 |
.SS "int hwloc_obj_type_snprintf (char *restrict string, size_t size, \fBhwloc_obj_t\fP obj, int verbose)" |
| 52 |
|
| 53 |
.PP |
| 54 |
Stringify the type of a given topology object into a human-readable form\&. Contrary to \fBhwloc_obj_type_string()\fP, this function includes object-specific attributes (such as the Group depth, the Bridge type, or OS device type) in the output, and it requires the caller to provide the output buffer\&. |
| 55 |
|
| 56 |
.PP |
| 57 |
The output is guaranteed to be the same for all objects of a same topology level\&. |
| 58 |
|
| 59 |
.PP |
| 60 |
If \fRverbose\fP is 1, longer type names are used, e\&.g\&. L1Cache instead of L1\&. |
| 61 |
|
| 62 |
.PP |
| 63 |
The output string may be parsed back by \fBhwloc_type_sscanf()\fP\&. |
| 64 |
|
| 65 |
.PP |
| 66 |
If \fRsize\fP is 0, \fRstring\fP may safely be \fRNULL\fP\&. |
| 67 |
|
| 68 |
.PP |
| 69 |
\fBReturns\fP |
| 70 |
.RS 4 |
| 71 |
the number of characters that were actually written if not truncating, or that would have been written (not including the ending \fR\\0\fP)\&. |
| 72 |
.RE |
| 73 |
.PP |
| 74 |
|
| 75 |
.SS "const char * hwloc_obj_type_string (\fBhwloc_obj_type_t\fP type)" |
| 76 |
|
| 77 |
.PP |
| 78 |
Return a constant stringified object type\&. This function is the basic way to convert a generic type into a string\&. The output string may be parsed back by \fBhwloc_type_sscanf()\fP\&. |
| 79 |
|
| 80 |
.PP |
| 81 |
\fBhwloc_obj_type_snprintf()\fP may return a more precise output for a specific object, but it requires the caller to provide the output buffer\&. |
| 82 |
|
| 83 |
.PP |
| 84 |
\fBReturns\fP |
| 85 |
.RS 4 |
| 86 |
A constant string containing the object type name or \fR"Unknown"\fP\&. |
| 87 |
.RE |
| 88 |
.PP |
| 89 |
|
| 90 |
.SS "int hwloc_type_sscanf (const char * string, \fBhwloc_obj_type_t\fP * typep, union \fBhwloc_obj_attr_u\fP * attrp, size_t attrsize)" |
| 91 |
|
| 92 |
.PP |
| 93 |
Return an object type and attributes from a type string\&. Convert strings such as "Package" or "L1iCache" into the corresponding types\&. Matching is case-insensitive, and only the first letters are actually required to match\&. |
| 94 |
|
| 95 |
.PP |
| 96 |
The matched object type is set in \fRtypep\fP (which cannot be \fRNULL\fP)\&. |
| 97 |
|
| 98 |
.PP |
| 99 |
Type-specific attributes, for instance Cache type, Cache depth, Group depth, Bridge type or OS Device type may be returned in \fRattrp\fP\&. Attributes that are not specified in the string (for instance "Group" without a depth, or "L2Cache" without a cache type) are set to -1\&. |
| 100 |
|
| 101 |
.PP |
| 102 |
\fRattrp\fP is only filled if not \fRNULL\fP and if its size specified in \fRattrsize\fP is large enough\&. It should be at least as large as union \fBhwloc_obj_attr_u\fP\&. |
| 103 |
|
| 104 |
.PP |
| 105 |
\fBReturns\fP |
| 106 |
.RS 4 |
| 107 |
0 if a type was correctly identified, otherwise -1\&. |
| 108 |
.RE |
| 109 |
.PP |
| 110 |
\fBNote\fP |
| 111 |
.RS 4 |
| 112 |
This function is guaranteed to match any string returned by \fBhwloc_obj_type_string()\fP or \fBhwloc_obj_type_snprintf()\fP\&. |
| 113 |
|
| 114 |
.PP |
| 115 |
This is an extended version of the now deprecated hwloc_obj_type_sscanf()\&. |
| 116 |
.RE |
| 117 |
.PP |
| 118 |
|
| 119 |
.SS "int hwloc_type_sscanf_as_depth (const char * string, \fBhwloc_obj_type_t\fP * typep, \fBhwloc_topology_t\fP topology, int * depthp)" |
| 120 |
|
| 121 |
.PP |
| 122 |
Return an object type and its level depth from a type string\&. Convert strings such as "Package" or "L1iCache" into the corresponding types and return in \fRdepthp\fP the depth of the corresponding level in the topology \fRtopology\fP\&. |
| 123 |
|
| 124 |
.PP |
| 125 |
If no object of this type is present on the underlying architecture, \fBHWLOC_TYPE_DEPTH_UNKNOWN\fP is returned\&. |
| 126 |
|
| 127 |
.PP |
| 128 |
If multiple such levels exist (for instance if giving Group without any depth), the function may return \fBHWLOC_TYPE_DEPTH_MULTIPLE\fP instead\&. |
| 129 |
|
| 130 |
.PP |
| 131 |
The matched object type is set in \fRtypep\fP if \fRtypep\fP is non \fRNULL\fP\&. |
| 132 |
|
| 133 |
.PP |
| 134 |
\fBNote\fP |
| 135 |
.RS 4 |
| 136 |
This function is similar to \fBhwloc_type_sscanf()\fP followed by \fBhwloc_get_type_depth()\fP but it also automatically disambiguates multiple group levels etc\&. |
| 137 |
|
| 138 |
.PP |
| 139 |
This function is guaranteed to match any string returned by \fBhwloc_obj_type_string()\fP or \fBhwloc_obj_type_snprintf()\fP\&. |
| 140 |
.RE |
| 141 |
.PP |
| 142 |
|
| 143 |
.SH "Author" |
| 144 |
.PP |
| 145 |
Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code\&. |