Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(537)

Delta Between Two Patch Sets: src/pkg/runtime/mgc0.c

Issue 123700044: code review 123700044: runtime: convert timers to Go (Closed)
Left Patch Set: diff -r bebfeba1e59da4d4570048e941743ae2452690d9 https://dvyukov%40google.com@code.google.com/p/go/ Created 10 years, 6 months ago
Right Patch Set: diff -r 3f13ed48b37ed52cd347d23aa321f81a4ec2c44d https://dvyukov%40google.com@code.google.com/p/go/ Created 10 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/pkg/runtime/netpoll.goc » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Garbage collector (GC). 5 // Garbage collector (GC).
6 // 6 //
7 // GC is: 7 // GC is:
8 // - mark&sweep 8 // - mark&sweep
9 // - mostly precise (with the exception of some C-allocated objects, assembly fr ames/arguments, etc) 9 // - mostly precise (with the exception of some C-allocated objects, assembly fr ames/arguments, etc)
10 // - parallel (up to MaxGcproc threads) 10 // - parallel (up to MaxGcproc threads)
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 for(i=0; i<n; i++) 1614 for(i=0; i<n; i++)
1615 p[i] = mstats.pause_ns[(mstats.numgc-1-i)%nelem(mstats.pause_ns) ]; 1615 p[i] = mstats.pause_ns[(mstats.numgc-1-i)%nelem(mstats.pause_ns) ];
1616 1616
1617 p[n] = mstats.last_gc; 1617 p[n] = mstats.last_gc;
1618 p[n+1] = mstats.numgc; 1618 p[n+1] = mstats.numgc;
1619 p[n+2] = mstats.pause_total_ns;· 1619 p[n+2] = mstats.pause_total_ns;·
1620 runtime·unlock(&runtime·mheap.lock); 1620 runtime·unlock(&runtime·mheap.lock);
1621 pauses->len = n+3; 1621 pauses->len = n+3;
1622 } 1622 }
1623 1623
1624 int32 1624 void
1625 runtime·setgcpercent(int32 in) { 1625 runtime·setgcpercent_m(void) {
1626 » int32 in;
1626 int32 out; 1627 int32 out;
1628
1629 in = (int32)(intptr)g->m->scalararg[0];
1627 1630
1628 runtime·lock(&runtime·mheap.lock); 1631 runtime·lock(&runtime·mheap.lock);
1629 out = runtime·gcpercent; 1632 out = runtime·gcpercent;
1630 if(in < 0) 1633 if(in < 0)
1631 in = -1; 1634 in = -1;
1632 runtime·gcpercent = in; 1635 runtime·gcpercent = in;
1633 runtime·unlock(&runtime·mheap.lock); 1636 runtime·unlock(&runtime·mheap.lock);
1634 » return out; 1637
1638 » g->m->scalararg[0] = (uintptr)(intptr)out;
1635 } 1639 }
1636 1640
1637 static void 1641 static void
1638 gchelperstart(void) 1642 gchelperstart(void)
1639 { 1643 {
1640 if(g->m->helpgc < 0 || g->m->helpgc >= MaxGcproc) 1644 if(g->m->helpgc < 0 || g->m->helpgc >= MaxGcproc)
1641 runtime·throw("gchelperstart: bad m->helpgc"); 1645 runtime·throw("gchelperstart: bad m->helpgc");
1642 if(g != g->m->g0) 1646 if(g != g->m->g0)
1643 runtime·throw("gchelper not running on g0 stack"); 1647 runtime·throw("gchelper not running on g0 stack");
1644 } 1648 }
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
2129 2133
2130 void runtime·gc_unixnanotime(int64 *now); 2134 void runtime·gc_unixnanotime(int64 *now);
2131 2135
2132 int64 runtime·unixnanotime(void) 2136 int64 runtime·unixnanotime(void)
2133 { 2137 {
2134 int64 now; 2138 int64 now;
2135 2139
2136 runtime·gc_unixnanotime(&now); 2140 runtime·gc_unixnanotime(&now);
2137 return now; 2141 return now;
2138 } 2142 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b