~braiampe/+junk/cgminer

« back to all changes in this revision

Viewing changes to ADL_SDK/cal_ext_counter.h

  • Committer: Braiam Peguero
  • Date: 2011-10-09 06:47:47 UTC
  • Revision ID: braiamp@gmail.com-20111009064747-iju2nhzrh6ya56zs
* Forgot adding files to the branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/* ============================================================
 
3
 
 
4
Copyright (c) 2007 Advanced Micro Devices, Inc.  All rights reserved.
 
5
 
 
6
Redistribution and use of this material is permitted under the following
 
7
conditions:
 
8
 
 
9
Redistributions must retain the above copyright notice and all terms of this
 
10
license.
 
11
 
 
12
In no event shall anyone redistributing or accessing or using this material
 
13
commence or participate in any arbitration or legal action relating to this
 
14
material against Advanced Micro Devices, Inc. or any copyright holders or
 
15
contributors. The foregoing shall survive any expiration or termination of
 
16
this license or any agreement or access or use related to this material.
 
17
 
 
18
ANY BREACH OF ANY TERM OF THIS LICENSE SHALL RESULT IN THE IMMEDIATE REVOCATION
 
19
OF ALL RIGHTS TO REDISTRIBUTE, ACCESS OR USE THIS MATERIAL.
 
20
 
 
21
THIS MATERIAL IS PROVIDED BY ADVANCED MICRO DEVICES, INC. AND ANY COPYRIGHT
 
22
HOLDERS AND CONTRIBUTORS "AS IS" IN ITS CURRENT CONDITION AND WITHOUT ANY
 
23
REPRESENTATIONS, GUARANTEE, OR WARRANTY OF ANY KIND OR IN ANY WAY RELATED TO
 
24
SUPPORT, INDEMNITY, ERROR FREE OR UNINTERRUPTED OPERATION, OR THAT IT IS FREE
 
25
FROM DEFECTS OR VIRUSES.  ALL OBLIGATIONS ARE HEREBY DISCLAIMED - WHETHER
 
26
EXPRESS, IMPLIED, OR STATUTORY - INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED
 
27
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
 
28
ACCURACY, COMPLETENESS, OPERABILITY, QUALITY OF SERVICE, OR NON-INFRINGEMENT.
 
29
IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. OR ANY COPYRIGHT HOLDERS OR
 
30
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, PUNITIVE,
 
31
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
 
32
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, REVENUE, DATA, OR PROFITS; OR
 
33
BUSINESS INTERRUPTION) HOWEVER CAUSED OR BASED ON ANY THEORY OF LIABILITY
 
34
ARISING IN ANY WAY RELATED TO THIS MATERIAL, EVEN IF ADVISED OF THE POSSIBILITY
 
35
OF SUCH DAMAGE. THE ENTIRE AND AGGREGATE LIABILITY OF ADVANCED MICRO DEVICES,
 
36
INC. AND ANY COPYRIGHT HOLDERS AND CONTRIBUTORS SHALL NOT EXCEED TEN DOLLARS
 
37
(US $10.00). ANYONE REDISTRIBUTING OR ACCESSING OR USING THIS MATERIAL ACCEPTS
 
38
THIS ALLOCATION OF RISK AND AGREES TO RELEASE ADVANCED MICRO DEVICES, INC. AND
 
39
ANY COPYRIGHT HOLDERS AND CONTRIBUTORS FROM ANY AND ALL LIABILITIES,
 
40
OBLIGATIONS, CLAIMS, OR DEMANDS IN EXCESS OF TEN DOLLARS (US $10.00). THE
 
41
FOREGOING ARE ESSENTIAL TERMS OF THIS LICENSE AND, IF ANY OF THESE TERMS ARE
 
42
CONSTRUED AS UNENFORCEABLE, FAIL IN ESSENTIAL PURPOSE, OR BECOME VOID OR
 
43
DETRIMENTAL TO ADVANCED MICRO DEVICES, INC. OR ANY COPYRIGHT HOLDERS OR
 
44
CONTRIBUTORS FOR ANY REASON, THEN ALL RIGHTS TO REDISTRIBUTE, ACCESS OR USE
 
45
THIS MATERIAL SHALL TERMINATE IMMEDIATELY. MOREOVER, THE FOREGOING SHALL
 
46
SURVIVE ANY EXPIRATION OR TERMINATION OF THIS LICENSE OR ANY AGREEMENT OR
 
47
ACCESS OR USE RELATED TO THIS MATERIAL.
 
48
 
 
49
NOTICE IS HEREBY PROVIDED, AND BY REDISTRIBUTING OR ACCESSING OR USING THIS
 
50
MATERIAL SUCH NOTICE IS ACKNOWLEDGED, THAT THIS MATERIAL MAY BE SUBJECT TO
 
51
RESTRICTIONS UNDER THE LAWS AND REGULATIONS OF THE UNITED STATES OR OTHER
 
52
COUNTRIES, WHICH INCLUDE BUT ARE NOT LIMITED TO, U.S. EXPORT CONTROL LAWS SUCH
 
53
AS THE EXPORT ADMINISTRATION REGULATIONS AND NATIONAL SECURITY CONTROLS AS
 
54
DEFINED THEREUNDER, AS WELL AS STATE DEPARTMENT CONTROLS UNDER THE U.S.
 
55
MUNITIONS LIST. THIS MATERIAL MAY NOT BE USED, RELEASED, TRANSFERRED, IMPORTED,
 
56
EXPORTED AND/OR RE-EXPORTED IN ANY MANNER PROHIBITED UNDER ANY APPLICABLE LAWS,
 
57
INCLUDING U.S. EXPORT CONTROL LAWS REGARDING SPECIFICALLY DESIGNATED PERSONS,
 
58
COUNTRIES AND NATIONALS OF COUNTRIES SUBJECT TO NATIONAL SECURITY CONTROLS.
 
59
MOREOVER, THE FOREGOING SHALL SURVIVE ANY EXPIRATION OR TERMINATION OF ANY
 
60
LICENSE OR AGREEMENT OR ACCESS OR USE RELATED TO THIS MATERIAL.
 
61
 
 
62
NOTICE REGARDING THE U.S. GOVERNMENT AND DOD AGENCIES: This material is
 
63
provided with "RESTRICTED RIGHTS" and/or "LIMITED RIGHTS" as applicable to
 
64
computer software and technical data, respectively. Use, duplication,
 
65
distribution or disclosure by the U.S. Government and/or DOD agencies is
 
66
subject to the full extent of restrictions in all applicable regulations,
 
67
including those found at FAR52.227 and DFARS252.227 et seq. and any successor
 
68
regulations thereof. Use of this material by the U.S. Government and/or DOD
 
69
agencies is acknowledgment of the proprietary rights of any copyright holders
 
70
and contributors, including those of Advanced Micro Devices, Inc., as well as
 
71
the provisions of FAR52.227-14 through 23 regarding privately developed and/or
 
72
commercial computer software.
 
73
 
 
74
This license forms the entire agreement regarding the subject matter hereof and
 
75
supersedes all proposals and prior discussions and writings between the parties
 
76
with respect thereto. This license does not affect any ownership, rights, title,
 
77
or interest in, or relating to, this material. No terms of this license can be
 
78
modified or waived, and no breach of this license can be excused, unless done
 
79
so in a writing signed by all affected parties. Each term of this license is
 
80
separately enforceable. If any term of this license is determined to be or
 
81
becomes unenforceable or illegal, such term shall be reformed to the minimum
 
82
extent necessary in order for this license to remain in effect in accordance
 
83
with its terms as modified by such reformation. This license shall be governed
 
84
by and construed in accordance with the laws of the State of Texas without
 
85
regard to rules on conflicts of law of any state or jurisdiction or the United
 
86
Nations Convention on the International Sale of Goods. All disputes arising out
 
87
of this license shall be subject to the jurisdiction of the federal and state
 
88
courts in Austin, Texas, and all defenses are hereby waived concerning personal
 
89
jurisdiction and venue of these courts.
 
90
 
 
91
============================================================ */
 
92
 
 
93
 
 
94
 
 
95
#ifndef __CAL_EXT_COUNTER_H__
 
96
#define __CAL_EXT_COUNTER_H__
 
97
 
 
98
#include "cal.h"
 
99
#include "cal_ext.h"
 
100
 
 
101
#ifdef __cplusplus
 
102
extern "C" {
 
103
#define CALAPI
 
104
#else
 
105
#define CALAPI extern
 
106
#endif
 
107
 
 
108
#ifndef CALAPIENTRYP
 
109
#define CALAPIENTRYP CALAPIENTRY *
 
110
#endif
 
111
 
 
112
typedef enum CALcountertypeEnum
 
113
{
 
114
    CAL_COUNTER_IDLE,
 
115
    CAL_COUNTER_INPUT_CACHE_HIT_RATE
 
116
} CALcountertype;
 
117
 
 
118
/*
 
119
 * Performance counter functions
 
120
 */
 
121
typedef CALuint CALcounter;
 
122
 
 
123
 
 
124
/*
 
125
 * Create a new performance counter object.
 
126
 *
 
127
 * counter (out) - Pointer to the returned counter object handle.
 
128
 * ctx (in) - Context in which to create the counter.
 
129
 * type (in) - Value to count.
 
130
 */
 
131
typedef CALresult (CALAPIENTRYP PFNCALCTXCREATECOUNTER)(CALcounter* counter, CALcontext ctx, CALcountertype type);
 
132
 
 
133
/*
 
134
 * Destroy a counter object.
 
135
 *
 
136
 * ctx (in) - Context that owns the counter.
 
137
 * counter (in) - Counter to destroy.
 
138
 */
 
139
typedef CALresult (CALAPIENTRYP PFNCALCTXDESTROYCOUNTER)(CALcontext ctx, CALcounter counter);
 
140
 
 
141
/*
 
142
 * Tell the specified counter object to begin counting.  This should be called
 
143
 * after calCtxConfigCounter and before the calls to calCtxRunProgram or
 
144
 * calMemCopy you are trying to profile.
 
145
 *
 
146
 * ctx (in) - Context that owns the counter.
 
147
 * counter (in) - Counter to start.
 
148
 */
 
149
typedef CALresult (CALAPIENTRYP PFNCALCTXBEGINCOUNTER)(CALcontext ctx, CALcounter counter);
 
150
 
 
151
/*
 
152
 * Tell the specified counter object to stop counting.  This should be called
 
153
 * after the calls to calCtxRunProgram or calMemCopy you are trying to profile
 
154
 * and before calCtxGetCounter.
 
155
 *
 
156
 * ctx (in) - Context that owns the counter.
 
157
 * counter (in) - Counter to stop.
 
158
 */
 
159
typedef CALresult (CALAPIENTRYP PFNCALCTXENDCOUNTER)(CALcontext ctx, CALcounter counter);
 
160
 
 
161
/*
 
162
 * Retrieve the results from a counter object.  This should be called after
 
163
 * calCtxEndCounter.  
 
164
 *
 
165
 * result (out) - Pointer to a CALfloat that will store counter results.
 
166
 * ctx (in) - Context that owns the counter.
 
167
 * counter (in) - Counter from which to retrieve results.
 
168
 */
 
169
typedef CALresult (CALAPIENTRYP PFNCALCTXGETCOUNTER)(CALfloat* result, CALcontext ctx, CALcounter counter);
 
170
 
 
171
#ifdef __cplusplus
 
172
}      /* extern "C" { */
 
173
#endif
 
174
 
 
175
#endif
 
176
 
 
177