X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=sidebyside;f=ltt%2Fbranches%2Fpoly%2Fltt%2Fevent.c;h=3b28f57616ed5baa6eb0ff74c3fc2fffdbfc6584;hb=2864f4c5ccd6f4d5401b40a05b4f4d816617a557;hp=8a3174cff8a8e124322dd5ed75b2fa217f10c72f;hpb=a5dcde2f975b43a9c6069c4a346528588bf1f8c8;p=lttv.git diff --git a/ltt/branches/poly/ltt/event.c b/ltt/branches/poly/ltt/event.c index 8a3174cf..3b28f576 100644 --- a/ltt/branches/poly/ltt/event.c +++ b/ltt/branches/poly/ltt/event.c @@ -1,3 +1,21 @@ +/* This file is part of the Linux Trace Toolkit viewer + * Copyright (C) 2003-2004 Xiangxiu Yang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License Version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + #include #include #include @@ -252,8 +270,23 @@ void ltt_event_position_set(LttEventPosition *ep, ****************************************************************************/ unsigned ltt_event_cpu_id(LttEvent *e) -{ - return (unsigned)atoi(e->tracefile->name); +{ + char * c1, * c2, * c3; + c1 = strrchr(e->tracefile->name,'\\'); + c2 = strrchr(e->tracefile->name,'/'); + if(c1 == NULL && c2 == NULL){ + return (unsigned)atoi(e->tracefile->name); + }else if(c1 == NULL){ + c2++; + return (unsigned)atoi(c2); + }else if(c2 == NULL){ + c1++; + return (unsigned)atoi(c1); + }else{ + c3 = (c1 > c2) ? c1 : c2; + c3++; + return (unsigned)atoi(c3); + } } /*****************************************************************************