hwlocality_object_strings.3 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. .TH "hwlocality_object_strings" 3 "Thu Sep 7 2023" "Version 2.9.3" "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. .in +1c
  11. .ti -1c
  12. .RI "const char * \fBhwloc_obj_type_string\fP (\fBhwloc_obj_type_t\fP type)"
  13. .br
  14. .ti -1c
  15. .RI "int \fBhwloc_obj_type_snprintf\fP (char *restrict string, size_t size, \fBhwloc_obj_t\fP obj, int verbose)"
  16. .br
  17. .ti -1c
  18. .RI "int \fBhwloc_obj_attr_snprintf\fP (char *restrict string, size_t size, \fBhwloc_obj_t\fP obj, const char *restrict separator, int verbose)"
  19. .br
  20. .ti -1c
  21. .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)"
  22. .br
  23. .ti -1c
  24. .RI "int \fBhwloc_type_sscanf_as_depth\fP (const char *string, \fBhwloc_obj_type_t\fP *typep, \fBhwloc_topology_t\fP topology, int *depthp)"
  25. .br
  26. .in -1c
  27. .SH "Detailed Description"
  28. .PP
  29. .SH "Function Documentation"
  30. .PP
  31. .SS "int hwloc_obj_attr_snprintf (char *restrict string, size_t size, \fBhwloc_obj_t\fP obj, const char *restrict separator, int verbose)"
  32. .PP
  33. Stringify the attributes of a given topology object into a human-readable form\&. Attribute values are separated by \fCseparator\fP\&.
  34. .PP
  35. Only the major attributes are printed in non-verbose mode\&.
  36. .PP
  37. If \fCsize\fP is 0, \fCstring\fP may safely be \fCNULL\fP\&.
  38. .PP
  39. \fBReturns\fP
  40. .RS 4
  41. the number of characters that were actually written if not truncating, or that would have been written (not including the ending \\0)\&.
  42. .RE
  43. .PP
  44. .SS "int hwloc_obj_type_snprintf (char *restrict string, size_t size, \fBhwloc_obj_t\fP obj, int verbose)"
  45. .PP
  46. 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\&.
  47. .PP
  48. The output is guaranteed to be the same for all objects of a same topology level\&.
  49. .PP
  50. If \fCverbose\fP is 1, longer type names are used, e\&.g\&. L1Cache instead of L1\&.
  51. .PP
  52. The output string may be parsed back by \fBhwloc_type_sscanf()\fP\&.
  53. .PP
  54. If \fCsize\fP is 0, \fCstring\fP may safely be \fCNULL\fP\&.
  55. .PP
  56. \fBReturns\fP
  57. .RS 4
  58. the number of characters that were actually written if not truncating, or that would have been written (not including the ending \\0)\&.
  59. .RE
  60. .PP
  61. .SS "const char * hwloc_obj_type_string (\fBhwloc_obj_type_t\fP type)"
  62. .PP
  63. 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\&.
  64. .PP
  65. \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\&.
  66. .PP
  67. \fBReturns\fP
  68. .RS 4
  69. A constant string containing the object type name or \fC'Unknown'\fP\&.
  70. .RE
  71. .PP
  72. .SS "int hwloc_type_sscanf (const char * string, \fBhwloc_obj_type_t\fP * typep, union \fBhwloc_obj_attr_u\fP * attrp, size_t attrsize)"
  73. .PP
  74. 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\&.
  75. .PP
  76. The matched object type is set in \fCtypep\fP (which cannot be \fCNULL\fP)\&.
  77. .PP
  78. Type-specific attributes, for instance Cache type, Cache depth, Group depth, Bridge type or OS Device type may be returned in \fCattrp\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\&.
  79. .PP
  80. \fCattrp\fP is only filled if not \fCNULL\fP and if its size specified in \fCattrsize\fP is large enough\&. It should be at least as large as union \fBhwloc_obj_attr_u\fP\&.
  81. .PP
  82. \fBReturns\fP
  83. .RS 4
  84. 0 if a type was correctly identified, otherwise -1\&.
  85. .RE
  86. .PP
  87. \fBNote\fP
  88. .RS 4
  89. This function is guaranteed to match any string returned by \fBhwloc_obj_type_string()\fP or \fBhwloc_obj_type_snprintf()\fP\&.
  90. .PP
  91. This is an extended version of the now deprecated hwloc_obj_type_sscanf()\&.
  92. .RE
  93. .PP
  94. .SS "int hwloc_type_sscanf_as_depth (const char * string, \fBhwloc_obj_type_t\fP * typep, \fBhwloc_topology_t\fP topology, int * depthp)"
  95. .PP
  96. 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 \fCdepthp\fP the depth of the corresponding level in the topology \fCtopology\fP\&.
  97. .PP
  98. If no object of this type is present on the underlying architecture, \fBHWLOC_TYPE_DEPTH_UNKNOWN\fP is returned\&.
  99. .PP
  100. If multiple such levels exist (for instance if giving Group without any depth), the function may return \fBHWLOC_TYPE_DEPTH_MULTIPLE\fP instead\&.
  101. .PP
  102. The matched object type is set in \fCtypep\fP if \fCtypep\fP is non \fCNULL\fP\&.
  103. .PP
  104. \fBNote\fP
  105. .RS 4
  106. 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\&.
  107. .PP
  108. This function is guaranteed to match any string returned by \fBhwloc_obj_type_string()\fP or \fBhwloc_obj_type_snprintf()\fP\&.
  109. .RE
  110. .PP
  111. .SH "Author"
  112. .PP
  113. Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code\&.