> For the complete documentation index, see [llms.txt](https://eric-lo.gitbook.io/program-optimization/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://eric-lo.gitbook.io/program-optimization/measurement.md).

# 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
```
