Code Monkey home page Code Monkey logo

go_goroutines_example's Introduction

GoRoutines example with timings

In this example I am demonstrating the usage of GoRoutines.
As you can see with the recorded timings, more than one CPU core is used here.

Program execution

The program flow is as follows:

  • Print time of execution start in console
  • Repeat GoRoutine calls
  • Pause execution in order for the GoRoutines to complete
  • Print time of execution stop in console

SOS! pause execution time must be greater than repeat call time

Console Output

A sample of console output is shown here

2019-03-12 13:45:08.8492231 +0200 EET m=+0.001001101 - Start
2019-03-12 13:45:10.8548423 +0200 EET m=+2.006555901 - repeater_2
2019-03-12 13:45:10.854973 +0200 EET m=+2.006686701 - repeater_13
2019-03-12 13:45:10.854973 +0200 EET m=+2.006686701 - repeater_10
2019-03-12 13:45:10.8548423 +0200 EET m=+2.006555901 - repeater_5
2019-03-12 13:45:10.854973 +0200 EET m=+2.006686701 - repeater_19
2019-03-12 13:45:10.854973 +0200 EET m=+2.006686701 - repeater_7
2019-03-12 13:45:10.854973 +0200 EET m=+2.006686701 - repeater_6
2019-03-12 13:45:10.854973 +0200 EET m=+2.006686701 - repeater_8
2019-03-12 13:45:10.854973 +0200 EET m=+2.006686701 - repeater_1
2019-03-12 13:45:10.854973 +0200 EET m=+2.006686701 - repeater_14
2019-03-12 13:45:10.854973 +0200 EET m=+2.006686701 - repeater_4
2019-03-12 13:45:10.854973 +0200 EET m=+2.006686701 - repeater_18
2019-03-12 13:45:10.854973 +0200 EET m=+2.006686701 - repeater_3
2019-03-12 13:45:10.854973 +0200 EET m=+2.006686701 - repeater_17
2019-03-12 13:45:10.854973 +0200 EET m=+2.006686701 - repeater_16
2019-03-12 13:45:10.854973 +0200 EET m=+2.006686701 - repeater_15
2019-03-12 13:45:10.854973 +0200 EET m=+2.006686701 - repeater_11
2019-03-12 13:45:10.854973 +0200 EET m=+2.006686701 - repeater_9
2019-03-12 13:45:10.854973 +0200 EET m=+2.006686701 - repeater_0
2019-03-12 13:45:10.8548423 +0200 EET m=+2.006555901 - repeater_12
2019-03-12 13:45:11.8561176 +0200 EET m=+3.007799101 - End

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.