1
0
mirror of synced 2026-04-27 02:38:39 +08:00

!6 D语言移植

* Porting to D
* The pthread needed.
This commit is contained in:
BitWorld
2021-04-08 21:04:43 +08:00
committed by yitter
parent b3a77a2824
commit a82d9cb063
18 changed files with 768 additions and 3 deletions

38
D/test/source/GenTest.d Normal file
View File

@@ -0,0 +1,38 @@
module GenTest;
import yitter.contract.IIdGenerator;
import std.conv;
import std.datetime;
import std.stdio;
class GenTest {
private IIdGenerator IdGen;
private int GenIdCount;
private int WorkerId;
this(IIdGenerator idGen, int genIdCount, int workerId) {
GenIdCount = genIdCount;
IdGen = idGen;
WorkerId = workerId;
}
void GenStart() {
MonoTime start = MonoTime.currTime();
long id = 0;
for (int i = 0; i < GenIdCount; i++) {
id = IdGen.newLong();
}
MonoTime end = MonoTime.currTime();
Duration dur = end - start;
// writeln(id);
writeln("++++++++++++++++++++++++++++++++++++++++WorkerId: "
~ WorkerId.to!string() ~ ", total: " ~ dur.total!("msecs").to!string() ~ " ms");
}
}