summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnokMan <416828041@qq.com>2019-02-20 16:29:25 +0800
committerRyan Dahl <ry@tinyclouds.org>2019-02-20 03:29:25 -0500
commit8c6d6b2832d9bd39c4d6edee87a7489b780b8cde (patch)
treed0aee049d0f7e4ea9fe149964ce6896f5333c74a
parent9076592a31211c562c82fc3f3cc8556ad231955b (diff)
Add section explaining resources and metrics to the manual (#1819)
-rw-r--r--website/manual.html2
-rw-r--r--website/manual.md38
-rw-r--r--website/style.css1
3 files changed, 40 insertions, 1 deletions
diff --git a/website/manual.html b/website/manual.html
index 0ce361838..ec2b55421 100644
--- a/website/manual.html
+++ b/website/manual.html
@@ -25,7 +25,7 @@
const response = await fetch(url);
const content = await response.text();
- let converter = new showdown.Converter({ extensions: ["toc"] });
+ let converter = new showdown.Converter({ extensions: ["toc"], tables: true });
let html = converter.makeHtml(content);
const manual = document.getElementById("manual");
diff --git a/website/manual.md b/website/manual.md
index 524f1d449..ea6f21719 100644
--- a/website/manual.md
+++ b/website/manual.md
@@ -532,6 +532,44 @@ Particularly useful ones:
## Internal details
+### Deno and Linux analogy
+
+| **Linux** | **Deno** |
+| ------------------------------: | :------------------------------- |
+| Processes | Web Workers |
+| Syscalls | Ops |
+| File descriptors (fd) | [Resource ids (rid)](#resources) |
+| Scheduler | Tokio |
+| Userland: libc++ / glib / boost | deno_std |
+| /proc/\$\$/stat | [deno.metrics()](#metrics) |
+| man pages | deno --types |
+
+#### Resources
+
+Resources (AKA `rid`) are Deno's version of file descriptors. They are integer
+values used to refer to open files, sockets, and other concepts. For testing it
+would be good to be able to query the system for how many open resources there
+are.
+
+```ts
+import { resources, close } from "deno";
+console.log(resources());
+// output like: { 0: "stdin", 1: "stdout", 2: "stderr", 3: "repl" }
+
+// close resource by rid
+close(3);
+```
+
+#### Metrics
+
+Metrics is deno's internal counters for various statics.
+
+```ts
+import { metrics } from "deno";
+console.log(metrics());
+// output like: { opsDispatched: 1, opsCompleted: 1, bytesSentControl: 40, bytesSentData: 0, bytesReceived: 176 }
+```
+
### Schematic diagram
<img src="schematic_v0.2.png">
diff --git a/website/style.css b/website/style.css
index 0b78c4e07..f11f7e2ea 100644
--- a/website/style.css
+++ b/website/style.css
@@ -28,6 +28,7 @@ h1, h2, h3, h4, p, table {
table {
border-collapse: collapse;
+ margin-top: 8px;
}
td, th {
font-weight: normal;