sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 1 | /* |
| 2 | This file is part of drd, a data race detector. |
| 3 | |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 4 | Copyright (C) 2006-2008 Bart Van Assche |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 5 | bart.vanassche@gmail.com |
| 6 | |
| 7 | This program is free software; you can redistribute it and/or |
| 8 | modify it under the terms of the GNU General Public License as |
| 9 | published by the Free Software Foundation; either version 2 of the |
| 10 | License, or (at your option) any later version. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, but |
| 13 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program; if not, write to the Free Software |
| 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 20 | 02111-1307, USA. |
| 21 | |
| 22 | The GNU General Public License is contained in the file COPYING. |
| 23 | */ |
| 24 | |
| 25 | |
| 26 | #ifndef __SEGMENT_H |
| 27 | #define __SEGMENT_H |
| 28 | |
| 29 | |
| 30 | // Segments and segment lists. A segment represents information about |
| 31 | // a contiguous group of statements of a specific thread. There is a vector |
| 32 | // clock associated with each segment. |
| 33 | |
| 34 | |
| 35 | #include "drd_vc.h" |
| 36 | #include "pub_drd_bitmap.h" |
| 37 | #include "pub_tool_execontext.h" // ExeContext |
| 38 | #include "pub_tool_stacktrace.h" // StackTrace |
| 39 | |
| 40 | |
| 41 | typedef struct segment |
| 42 | { |
| 43 | struct segment* next; |
| 44 | struct segment* prev; |
bart | a2b6e1b | 2008-03-17 18:32:39 +0000 | [diff] [blame^] | 45 | int refcnt; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 46 | ExeContext* stacktrace; |
| 47 | VectorClock vc; |
| 48 | struct bitmap* bm; |
| 49 | } Segment; |
| 50 | |
bart | a2b6e1b | 2008-03-17 18:32:39 +0000 | [diff] [blame^] | 51 | |
bart | ed866d8 | 2008-02-24 18:29:10 +0000 | [diff] [blame] | 52 | Segment* sg_new(const ThreadId creator, const ThreadId created); |
bart | a2b6e1b | 2008-03-17 18:32:39 +0000 | [diff] [blame^] | 53 | int sg_get_refcnt(const Segment* const sg); |
| 54 | Segment* sg_get(Segment* const sg); |
| 55 | void sg_put(Segment* const sg); |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 56 | void sg_print(const Segment* const sg); |
| 57 | Bool sg_get_trace(void); |
bart | ed866d8 | 2008-02-24 18:29:10 +0000 | [diff] [blame] | 58 | void sg_set_trace(const Bool trace_segment); |
bart | 7102f10 | 2008-03-17 17:37:53 +0000 | [diff] [blame] | 59 | ULong sg_get_created_segments_count(void); |
| 60 | ULong sg_get_alive_segments_count(void); |
| 61 | ULong sg_get_max_alive_segments_count(void); |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 62 | |
| 63 | |
| 64 | #endif // __SEGMENT_H |