-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
59 additions
and
18 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) 2015, Viktor Dakalov. All rights reserved. Use of this source code | ||
// is governed by a BSD-style license that can be found in the LICENSE file. | ||
|
||
library dlog.example.time; | ||
|
||
import "dart:math"; | ||
import "package:dlog/dlog.dart" as dlog; | ||
|
||
// a function that is performed for a long time | ||
power() { | ||
int len = 1000; | ||
while (len-- > 0) { | ||
sqrt(pow(new Random().nextDouble(), new Random().nextDouble())); | ||
} | ||
} | ||
|
||
power2() { | ||
power(); | ||
} | ||
|
||
power3() { | ||
power(); | ||
} | ||
|
||
main() { | ||
|
||
// create Time object and specity descrption | ||
// object can be used throughout the application | ||
var debug = new dlog.Time("Cycle")..init(); | ||
|
||
// call check after separated logic operation | ||
debug.checkFunc("once call power", power); | ||
|
||
// call power several times | ||
debug.checkLoopFunc("call power in loop 10", 10, power3); | ||
|
||
// output | ||
print(debug); | ||
|
||
} |
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
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