github.com/ndau/noms@v1.0.5/go/nbs/benchmarks/cachedrop/drop_cache.go (about)

     1  // Copyright 2016 Attic Labs, Inc. All rights reserved.
     2  // Licensed under the Apache License, version 2.0:
     3  // http://www.apache.org/licenses/LICENSE-2.0
     4  
     5  package main
     6  
     7  import (
     8  	"log"
     9  	"os"
    10  )
    11  
    12  const dropCaches = "/proc/sys/vm/drop_caches"
    13  
    14  func main() {
    15  	f, err := os.OpenFile(dropCaches, os.O_WRONLY, 0666)
    16  	if err != nil {
    17  		log.Fatalln(err)
    18  	}
    19  
    20  	if _, err := f.WriteString("1"); err != nil {
    21  		log.Fatalln(err)
    22  	}
    23  }