Преглед изворни кода

Document experimental diagnosis interface (Final step of #243)

Further diagnosis information may be added independent of #243
bel2125 пре 8 година
родитељ
комит
63f4fe2a12
3 измењених фајлова са 38 додато и 2 уклоњено
  1. 36 0
      docs/api/mg_get_connection_info.md
  2. 2 0
      docs/api/mg_get_context_info.md
  3. 0 2
      include/civetweb.h

+ 36 - 0
docs/api/mg_get_connection_info.md

@@ -0,0 +1,36 @@
+# Civetweb API Reference
+
+### `mg_get_connection_info( ctx, idx, buffer, buflen );`
+
+### Parameters
+
+| Parameter | Type | Description |
+| :--- | :--- | :--- |
+|**`ctx`**|`struct mg_context *`|The server context handle|
+|**`idx`**|`int`|Connection index within the context|
+|**`buffer**|`char *`|A string buffer to store the information|
+|**`buflen**|`int`|Size of the string buffer (including space for a terminating 0)|
+
+### Return Value
+
+| Type | Description |
+| :--- | :--- |
+|`int`|Available context information in bytes (excluding the terminating 0)|
+
+### Description
+
+The function `mg_get_connection_info()` returns statistics information collected for a possible server connection. This may be empty if the server has not been built with statistics support (`#define USE_SERVER_STATS`). Otherwise the returned string is in JSON format.
+
+### Note
+
+This is an experimental interface and may be changed, replaced
+or even removed in the future. Currently the index `idx` must be
+between `0` and `num_threads-1`. The thread is not locked for
+performance reasons, so the information may be inconsistent 
+in rare cases.
+
+### See Also
+
+* [`mg_get_system_info();`](mg_get_system_info.md)
+* [`mg_get_context_info();`](mg_get_context_info.md)
+

+ 2 - 0
docs/api/mg_get_context_info.md

@@ -23,4 +23,6 @@ The function `mg_get_context_info()` returns statistics information collected fo
 ### See Also
 ### See Also
 
 
 * [`mg_get_system_info();`](mg_get_system_info.md)
 * [`mg_get_system_info();`](mg_get_system_info.md)
+* [`mg_get_connection_info();`](mg_get_connection_info.md)
+
 
 

+ 0 - 2
include/civetweb.h

@@ -1244,8 +1244,6 @@ CIVETWEB_API int
 mg_get_context_info(const struct mg_context *ctx, char *buffer, int buflen);
 mg_get_context_info(const struct mg_context *ctx, char *buffer, int buflen);
 
 
 
 
-#define MG_EXPERIMENTAL_INTERFACES
-
 #ifdef MG_EXPERIMENTAL_INTERFACES
 #ifdef MG_EXPERIMENTAL_INTERFACES
 /* Get connection information. Useful for server diagnosis.
 /* Get connection information. Useful for server diagnosis.
    Parameters:
    Parameters: