> 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). Agents can also search and read this documentation through its [MCP server](https://eric-lo.gitbook.io/program-optimization/~gitbook/mcp).

# 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="https://787307050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lp-5TQyO3X0E6rfxSLo%2F-Lp-5ZDODuspL7qs7UQY%2F-Lp-6W7WdUrct38bA0eI%2Fputty.png?generation=1568738785039691&amp;alt=media" 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.

![](https://787307050-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lp-5TQyO3X0E6rfxSLo%2F-Lp-5ZDODuspL7qs7UQY%2F-Lp-6W7Y8-zFRpYOZDFx%2Flinux9server.png?generation=1568738785020759\&alt=media)

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