mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
SSMetrics (#19719)
* SSMetrics * We were a bit too silly * Forgot to commit this * Logs CPU * Removes global data from all ss * And puts it on the metrics ss * Update metrics.dm * Logs profiler data * Adds profile configs * Update code/controllers/subsystem/metrics.dm Co-authored-by: adamsong <adamsong@users.noreply.github.com> * Log request errors * Final fixes * Rebuilds for 1.2.0-yogs1 * Apparnetly you can't split macro calls on multiple lines * Org is called yogstation13 not yogstation --------- Co-authored-by: alexkar598 <> Co-authored-by: adamsong <adamsong@users.noreply.github.com>
This commit is contained in:
@@ -107,6 +107,23 @@
|
||||
#define rustg_cnoise_generate(percentage, smoothing_iterations, birth_limit, death_limit, width, height) \
|
||||
RUSTG_CALL(RUST_G, "cnoise_generate")(percentage, smoothing_iterations, birth_limit, death_limit, width, height)
|
||||
|
||||
/**
|
||||
* This proc generates a grid of perlin-like noise
|
||||
*
|
||||
* Returns a single string that goes row by row, with values of 1 representing an turned on cell, and a value of 0 representing a turned off cell.
|
||||
*
|
||||
* Arguments:
|
||||
* * seed: seed for the function
|
||||
* * accuracy: how close this is to the original perlin noise, as accuracy approaches infinity, the noise becomes more and more perlin-like
|
||||
* * stamp_size: Size of a singular stamp used by the algorithm, think of this as the same stuff as frequency in perlin noise
|
||||
* * world_size: size of the returned grid.
|
||||
* * lower_range: lower bound of values selected for. (inclusive)
|
||||
* * upper_range: upper bound of values selected for. (exclusive)
|
||||
*/
|
||||
#define rustg_dbp_generate(seed, accuracy, stamp_size, world_size, lower_range, upper_range) \
|
||||
RUSTG_CALL(RUST_G, "dbp_generate")(seed, accuracy, stamp_size, world_size, lower_range, upper_range)
|
||||
|
||||
|
||||
#define rustg_dmi_strip_metadata(fname) RUSTG_CALL(RUST_G, "dmi_strip_metadata")(fname)
|
||||
#define rustg_dmi_create_png(path, width, height, data) RUSTG_CALL(RUST_G, "dmi_create_png")(path, width, height, data)
|
||||
#define rustg_dmi_resize_png(path, width, height, resizetype) RUSTG_CALL(RUST_G, "dmi_resize_png")(path, width, height, resizetype)
|
||||
@@ -126,6 +143,22 @@
|
||||
#define rustg_git_revparse(rev) RUSTG_CALL(RUST_G, "rg_git_revparse")(rev)
|
||||
#define rustg_git_commit_date(rev) RUSTG_CALL(RUST_G, "rg_git_commit_date")(rev)
|
||||
|
||||
#define rustg_hash_string(algorithm, text) RUSTG_CALL(RUST_G, "hash_string")(algorithm, text)
|
||||
#define rustg_hash_file(algorithm, fname) RUSTG_CALL(RUST_G, "hash_file")(algorithm, fname)
|
||||
#define rustg_hash_generate_totp(seed) RUSTG_CALL(RUST_G, "generate_totp")(seed)
|
||||
#define rustg_hash_generate_totp_tolerance(seed, tolerance) RUSTG_CALL(RUST_G, "generate_totp_tolerance")(seed, tolerance)
|
||||
|
||||
#define RUSTG_HASH_MD5 "md5"
|
||||
#define RUSTG_HASH_SHA1 "sha1"
|
||||
#define RUSTG_HASH_SHA256 "sha256"
|
||||
#define RUSTG_HASH_SHA512 "sha512"
|
||||
#define RUSTG_HASH_XXH64 "xxh64"
|
||||
#define RUSTG_HASH_BASE64 "base64"
|
||||
|
||||
#ifdef RUSTG_OVERRIDE_BUILTINS
|
||||
#define md5(thing) (isfile(thing) ? rustg_hash_file(RUSTG_HASH_MD5, "[thing]") : rustg_hash_string(RUSTG_HASH_MD5, thing))
|
||||
#endif
|
||||
|
||||
#define RUSTG_HTTP_METHOD_GET "get"
|
||||
#define RUSTG_HTTP_METHOD_PUT "put"
|
||||
#define RUSTG_HTTP_METHOD_DELETE "delete"
|
||||
@@ -136,6 +169,9 @@
|
||||
#define rustg_http_request_async(method, url, body, headers, options) RUSTG_CALL(RUST_G, "http_request_async")(method, url, body, headers, options)
|
||||
#define rustg_http_check_request(req_id) RUSTG_CALL(RUST_G, "http_check_request")(req_id)
|
||||
|
||||
#define rustg_influxdb2_publish(data, endpoint, token) RUSTG_CALL(RUST_G, "influxdb2_publish")(data, endpoint, token)
|
||||
#define rustg_influxdb2_publish_profile(data, endpoint, token, round_id) RUSTG_CALL(RUST_G, "influxdb2_publish_profile")(data, endpoint, token, round_id)
|
||||
|
||||
#define RUSTG_JOB_NO_RESULTS_YET "NO RESULTS YET"
|
||||
#define RUSTG_JOB_NO_SUCH_JOB "NO SUCH JOB"
|
||||
#define RUSTG_JOB_ERROR "JOB PANICKED"
|
||||
@@ -147,6 +183,47 @@
|
||||
|
||||
#define rustg_noise_get_at_coordinates(seed, x, y) RUSTG_CALL(RUST_G, "noise_get_at_coordinates")(seed, x, y)
|
||||
|
||||
/**
|
||||
* Register a list of nodes into a rust library. This list of nodes must have been serialized in a json.
|
||||
* Node {// Index of this node in the list of nodes
|
||||
* unique_id: usize,
|
||||
* // Position of the node in byond
|
||||
* x: usize,
|
||||
* y: usize,
|
||||
* z: usize,
|
||||
* // Indexes of nodes connected to this one
|
||||
* connected_nodes_id: Vec<usize>}
|
||||
* It is important that the node with the unique_id 0 is the first in the json, unique_id 1 right after that, etc.
|
||||
* It is also important that all unique ids follow. {0, 1, 2, 4} is not a correct list and the registering will fail
|
||||
* Nodes should not link across z levels.
|
||||
* A node cannot link twice to the same node and shouldn't link itself either
|
||||
*/
|
||||
#define rustg_register_nodes_astar(json) RUSTG_CALL(RUST_G, "register_nodes_astar")(json)
|
||||
|
||||
/**
|
||||
* Add a new node to the static list of nodes. Same rule as registering_nodes applies.
|
||||
* This node unique_id must be equal to the current length of the static list of nodes
|
||||
*/
|
||||
#define rustg_add_node_astar(json) RUSTG_CALL(RUST_G, "add_node_astar")(json)
|
||||
|
||||
/**²
|
||||
* Remove every link to the node with unique_id. Replace that node by null
|
||||
*/
|
||||
#define rustg_remove_node_astart(unique_id) RUSTG_CALL(RUST_G, "remove_node_astar")(unique_id)
|
||||
|
||||
/**
|
||||
* Compute the shortest path between start_node and goal_node using A*. Heuristic used is simple geometric distance
|
||||
*/
|
||||
#define rustg_generate_path_astar(start_node_id, goal_node_id) RUSTG_CALL(RUST_G, "generate_path_astar")(start_node_id, goal_node_id)
|
||||
|
||||
#define RUSTG_REDIS_ERROR_CHANNEL "RUSTG_REDIS_ERROR_CHANNEL"
|
||||
|
||||
#define rustg_redis_connect(addr) RUSTG_CALL(RUST_G, "redis_connect")(addr)
|
||||
/proc/rustg_redis_disconnect() return RUSTG_CALL(RUST_G, "redis_disconnect")()
|
||||
#define rustg_redis_subscribe(channel) RUSTG_CALL(RUST_G, "redis_subscribe")(channel)
|
||||
/proc/rustg_redis_get_messages() return RUSTG_CALL(RUST_G, "redis_get_messages")()
|
||||
#define rustg_redis_publish(channel, message) RUSTG_CALL(RUST_G, "redis_publish")(channel, message)
|
||||
|
||||
#define rustg_sql_connect_pool(options) RUSTG_CALL(RUST_G, "sql_connect_pool")(options)
|
||||
#define rustg_sql_query_async(handle, query, params) RUSTG_CALL(RUST_G, "sql_query_async")(handle, query, params)
|
||||
#define rustg_sql_query_blocking(handle, query, params) RUSTG_CALL(RUST_G, "sql_query_blocking")(handle, query, params)
|
||||
@@ -161,6 +238,9 @@
|
||||
/proc/rustg_unix_timestamp()
|
||||
return text2num(RUSTG_CALL(RUST_G, "unix_timestamp")())
|
||||
|
||||
/proc/rustg_unix_timestamp_int()
|
||||
return RUSTG_CALL(RUST_G, "unix_timestamp_int")()
|
||||
|
||||
#define rustg_raw_read_toml_file(path) json_decode(RUSTG_CALL(RUST_G, "toml_file_to_json")(path) || "null")
|
||||
|
||||
/proc/rustg_read_toml_file(path)
|
||||
@@ -179,6 +259,9 @@
|
||||
else
|
||||
CRASH(output["content"])
|
||||
|
||||
#define rustg_unzip_download_async(url, unzip_directory) RUSTG_CALL(RUST_G, "unzip_download_async")(url, unzip_directory)
|
||||
#define rustg_unzip_check(job_id) RUSTG_CALL(RUST_G, "unzip_check")("[job_id]")
|
||||
|
||||
#define rustg_url_encode(text) RUSTG_CALL(RUST_G, "url_encode")("[text]")
|
||||
#define rustg_url_decode(text) RUSTG_CALL(RUST_G, "url_decode")(text)
|
||||
|
||||
@@ -187,18 +270,20 @@
|
||||
#define url_decode(text) rustg_url_decode(text)
|
||||
#endif
|
||||
|
||||
#define rustg_hash_string(algorithm, text) RUSTG_CALL(RUST_G, "hash_string")(algorithm, text)
|
||||
#define rustg_hash_file(algorithm, fname) RUSTG_CALL(RUST_G, "hash_file")(algorithm, fname)
|
||||
#define rustg_hash_generate_totp(seed) RUSTG_CALL(RUST_G, "generate_totp")(seed)
|
||||
#define rustg_hash_generate_totp_tolerance(seed, tolerance) RUSTG_CALL(RUST_G, "generate_totp_tolerance")(seed, tolerance)
|
||||
/**
|
||||
* This proc generates a noise grid using worley noise algorithm
|
||||
*
|
||||
* Returns a single string that goes row by row, with values of 1 representing an alive cell, and a value of 0 representing a dead cell.
|
||||
*
|
||||
* Arguments:
|
||||
* * region_size: The size of regions
|
||||
* * threshold: the value that determines wether a cell is dead or alive
|
||||
* * node_per_region_chance: chance of a node existiing in a region
|
||||
* * size: size of the returned grid
|
||||
* * node_min: minimum amount of nodes in a region (after the node_per_region_chance is applied)
|
||||
* * node_max: maximum amount of nodes in a region
|
||||
*/
|
||||
#define rustg_worley_generate(region_size, threshold, node_per_region_chance, size, node_min, node_max) \
|
||||
RUSTG_CALL(RUST_G, "worley_generate")(region_size, threshold, node_per_region_chance, size, node_min, node_max)
|
||||
|
||||
#define RUSTG_HASH_MD5 "md5"
|
||||
#define RUSTG_HASH_SHA1 "sha1"
|
||||
#define RUSTG_HASH_SHA256 "sha256"
|
||||
#define RUSTG_HASH_SHA512 "sha512"
|
||||
#define RUSTG_HASH_XXH64 "xxh64"
|
||||
#define RUSTG_HASH_BASE64 "base64"
|
||||
|
||||
#ifdef RUSTG_OVERRIDE_BUILTINS
|
||||
#define md5(thing) (isfile(thing) ? rustg_hash_file(RUSTG_HASH_MD5, "[thing]") : rustg_hash_string(RUSTG_HASH_MD5, thing))
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user