Home | History | Annotate | Download | only in traceevent
      1 /*
      2  * Copyright (C) 2012 Red Hat Inc, Steven Rostedt <srostedt (at) redhat.com>
      3  *
      4  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      5  * This program is free software; you can redistribute it and/or
      6  * modify it under the terms of the GNU Lesser General Public
      7  * License as published by the Free Software Foundation;
      8  * version 2.1 of the License (not later!)
      9  *
     10  * This program is distributed in the hope that it will be useful,
     11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13  * GNU Lesser General Public License for more details.
     14  *
     15  * You should have received a copy of the GNU Lesser General Public
     16  * License along with this program; if not, write to the Free Software
     17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
     18  *
     19  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     20  */
     21 #ifndef _KBUFFER_H
     22 #define _KBUFFER_H
     23 
     24 #ifndef TS_SHIFT
     25 #define TS_SHIFT		27
     26 #endif
     27 
     28 enum kbuffer_endian {
     29 	KBUFFER_ENDIAN_BIG,
     30 	KBUFFER_ENDIAN_LITTLE,
     31 };
     32 
     33 enum kbuffer_long_size {
     34 	KBUFFER_LSIZE_4,
     35 	KBUFFER_LSIZE_8,
     36 };
     37 
     38 enum {
     39 	KBUFFER_TYPE_PADDING		= 29,
     40 	KBUFFER_TYPE_TIME_EXTEND	= 30,
     41 	KBUFFER_TYPE_TIME_STAMP		= 31,
     42 };
     43 
     44 struct kbuffer;
     45 
     46 struct kbuffer *kbuffer_alloc(enum kbuffer_long_size size, enum kbuffer_endian endian);
     47 void kbuffer_free(struct kbuffer *kbuf);
     48 int kbuffer_load_subbuffer(struct kbuffer *kbuf, void *subbuffer);
     49 void *kbuffer_read_event(struct kbuffer *kbuf, unsigned long long *ts);
     50 void *kbuffer_next_event(struct kbuffer *kbuf, unsigned long long *ts);
     51 unsigned long long kbuffer_timestamp(struct kbuffer *kbuf);
     52 
     53 void *kbuffer_translate_data(int swap, void *data, unsigned int *size);
     54 
     55 void *kbuffer_read_at_offset(struct kbuffer *kbuf, int offset, unsigned long long *ts);
     56 
     57 int kbuffer_curr_index(struct kbuffer *kbuf);
     58 
     59 int kbuffer_curr_offset(struct kbuffer *kbuf);
     60 int kbuffer_curr_size(struct kbuffer *kbuf);
     61 int kbuffer_event_size(struct kbuffer *kbuf);
     62 int kbuffer_missed_events(struct kbuffer *kbuf);
     63 int kbuffer_subbuffer_size(struct kbuffer *kbuf);
     64 
     65 void kbuffer_set_old_format(struct kbuffer *kbuf);
     66 
     67 #endif /* _K_BUFFER_H */
     68