# Measurement

This part briefly describes how to measure cache misses and TLB misses using [perf](https://perf.wiki.kernel.org/index.php/Main_Page).

**Important Note**:

Please run `perf` on department linux9 server. VM can **NOT** fully support `perf` statistics even though `perf` can be installed on VM successfully.

You should have been familiar with command-line interface and thus can connect to linux9 using the following command (when connected to CSE VPN):

```bash
ssh <YOUR_CSE_ACCOUNT>@linux9.cse.cuhk.edu.hk
```

But as an alternative, you can follow the steps below to connect to the department **linux9** servers using GUI.

* Download a SSH client and connect to the linux9 server. Here we use putty as an example.

  <figure><img src="/files/-Lp-6W7WdUrct38bA0eI" alt=""><figcaption></figcaption></figure>

The hostname is in the form of "<username@linux9.cse.cuhk.edu.hk>" where "username" should be replaced by your own CSE account.

* Enter your password and you can connect to the department **linux9** server.

![](/files/-Lp-6W7Y8-zFRpYOZDFx)

* Remember to add `-std=c11` when compiling your program, as the GCC version is a bit old on linux9. Also turn off the compiler optimization to see a more obvious gap. For example:

```
gcc -std=c11 -O0 -o helloworld helloworld.c
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://eric-lo.gitbook.io/program-optimization/measurement.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
