1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

Add section explaining resources and metrics to the manual (#1819)

This commit is contained in:
EnokMan 2019-02-20 16:29:25 +08:00 committed by Ryan Dahl
parent 9076592a31
commit 8c6d6b2832
3 changed files with 40 additions and 1 deletions

View file

@ -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");

View file

@ -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">

View file

@ -28,6 +28,7 @@ h1, h2, h3, h4, p, table {
table {
border-collapse: collapse;
margin-top: 8px;
}
td, th {
font-weight: normal;