Last active
December 3, 2018 01:31
-
-
Save Niraj-Fonseka/6a257869ae010170950d98e93447bfba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func main() { | |
start := time.Now() | |
FirstFunc() | |
SecondFunc() | |
ThirdFunc() | |
FourthFunc() | |
fmt.Printf("Total time to finish : %s \n", time.Since(start).String()) | |
} | |
func FirstFunc() { | |
fmt.Println("-- Executing first function --") | |
time.Sleep(7 * time.Second) | |
fmt.Println("-- First Function finished --") | |
} | |
func SecondFunc() { | |
fmt.Println("-- Executing second function --") | |
time.Sleep(5 * time.Second) | |
fmt.Println("-- Second Function finished --") | |
} | |
func ThirdFunc() { | |
fmt.Println("-- Executing third function --") | |
time.Sleep(2 * time.Second) | |
fmt.Println("-- Third Function finished --") | |
} | |
func FourthFunc() { | |
fmt.Println("-- Executing fourth function --") | |
time.Sleep(10 * time.Second) | |
fmt.Println("-- Fourth Function finished --") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment